Created
March 21, 2019 01:39
-
-
Save AAQ-AND-DEV/b8dbd61261f8b62f9fb1dd2bf665639b to your computer and use it in GitHub Desktop.
booleans and logical operators (XOR, OR, AND)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
String name = "James"; | |
String lastName = "Bond"; | |
int age = 45; | |
print('his name is ${name + ' ' + lastName} he is $age years old'); | |
print('his name is $name $lastName he is $age years old'); | |
print('${lastName.toUpperCase()}'); | |
bool isTheBest = false; | |
bool isTheGreatest = false; | |
bool isTheWorst = true; | |
bool isReallyBad = true; | |
print("logical AND"); | |
//logical conjunction -- true if both true, otherwise false | |
print(isTheBest & isTheWorst); | |
print(isTheBest & isTheGreatest); | |
print(isTheWorst & isReallyBad); | |
print("xor"); | |
//exclusive or -- returns whether neither both true nor both false | |
print(isTheBest ^ isTheWorst); //predict true | |
print(isTheBest ^ isTheGreatest); // predict false | |
print(isTheWorst ^ isReallyBad); //predict false | |
print("inclusive OR"); | |
//inclusive or | | |
print(isTheBest | isTheWorst); //predict true | |
print(isTheBest | isTheGreatest); //predict false | |
print(isTheWorst | isReallyBad); //predict true | |
print('${lastName.toUpperCase()} is $isTheBest'); | |
print('${lastName is String}'); | |
print('$isTheBest'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment