Created
June 22, 2022 16:54
-
-
Save ntatko/732b4f00cea26df32d5b872a26db2591 to your computer and use it in GitHub Desktop.
Relational operators in dart
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
| /// RELATIONAL OPERATORS | |
| void main() { | |
| // == | |
| bool fives = 5 == 5; // true | |
| bool mixed = 4 == 5; // false | |
| bool varred = fives == true; // true | |
| bool strings = "This" == "That"; // false | |
| bool sameStrings = "computeringstuff" == "computeringstuff"; // true | |
| // != | |
| bool fives2 = 5 != 5; // false | |
| bool mixed2 = 4 != 5; // true | |
| bool varred2 = fives2 != true; // true | |
| bool strings2 = "This" != "That"; // true | |
| bool sameStrings = "computeringstuff" != "computeringstuff"; // false | |
| // > | |
| bool fives3 = 5 > 5; // false | |
| bool mixed = 4 > 5; // false | |
| bool shouldBeTrue = 5 > 4.5; // true | |
| List arr = [1, 2, 3, 4, 5]; | |
| bool longer = arr.length > 4; // true | |
| bool zeroth = arr[0] > 0; // true | |
| // < | |
| bool fives4 = 5 < 5; // false | |
| bool mized = 4 < 5; // true | |
| bool shouldBeFalse = 4 < 3.5; //false | |
| // >= | |
| bool fives5 = 5 >= 5; // true | |
| bool mixed5 = 4 >= 5; // false | |
| bool shouldBeTrue 5 >= 4.5; // true | |
| // <= | |
| bool faves6 = 5 <= 5; // true | |
| bool mixed6 = 4 <= 5; // true | |
| bool shouldBeFalse2 = 5 <= 4; // false | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment