In this this section, we're going to learn about conditions.
A condition is an expression that can be evaluated as either
False. This is done using comparison
operators, logic operators, and booleans.
Many of the comparison operators might be familiar from your math
class. These include:
||less than or equal
||greater than or equal
For example, the expression
15 < 20 would be
True because 15 is indeed less than 20, and
"hello" == "goodbye" would be
the phrases "hello" and "goodbye" are not the same.
We can also use the logic operators
not (to turn an
False and vice
and (to combine two expressions that must both be
or (to combine two expressions
where at least one must be
Booleans are another type of variable which can only have one of two