Skip to main content

Conditional Operators

note

On top of these operators, there are also conditional operators.

These variables produce a boolean value, True or False.

OperationSyntaxDescriptionExample
(-> output)
Equalitya == bChecks if the value of a is
equal to the value of b
1 == 2 -> False
Strict Inequality
(greater-than,
less-than
)
a < b
b > a
Checks if the value of
a is less-than < b, or
b is greater-than > a
1 < 2 -> True
Non-Strict Inequality
(greater-than
or equal to
)
(less-than
or equal to
)
a <= bChecks if the value of
aless-than or equal to <= b or
b is greater-than or equal to => a
1 <= 1 -> True
Not Equal Toa != bChecks if a is not equal to b1 != 2 -> True
Truth TestaFinds the Truth value of a
(Don't worry about this yet!)
1 -> True
Logical Negationnot aNegates the truth value of anot True -> False