Conditional Operators
note
On top of these operators, there are also conditional operators.
These variables produce a boolean value, True
or False
.
Operation | Syntax | Description | Example (-> output ) |
---|---|---|---|
Equality | a == b | Checks if the value of a isequal to the value of b | 1 == 2 -> False |
Strict Inequality (greater-than, less-than) | a < b b > a | Checks if the value ofa is less-than < b , orb is greater-than > a | 1 < 2 -> True |
Non-Strict Inequality (greater-than or equal to) (less-than or equal to) | a <= b | Checks if the value ofa less-than or equal to <= b orb is greater-than or equal to => a | 1 <= 1 -> True |
Not Equal To | a != b | Checks if a is not equal to b | 1 != 2 -> True |
Truth Test | a | Finds the Truth value of a (Don't worry about this yet!) | 1 -> True |
Logical Negation | not a | Negates the truth value of a | not True -> False |