|
What exactly does "not" mean in an an if statement? Does it mean to proceed to the next step only if the text expression is False instead of True? |
|
Not changes True to False or False to True. If not True means If False, If not False - means If True. |
|
This has to do with boolean variables. 'not', as you point out, is the opposite. For example
is exactly the same as
You can combine the 3 boolean operators - not, and and or - to make very complex expressions. For example: if not(sick or busy) and not(is_raining or is_hailing or is_snowing) and ( (have money for gas) or (can get a ride)):
go surfing
In this case, the expressions are evaluated like in math.. first evaluate the most inner parenthesis and work your way outwards. |