iNTERFACEWARE Products Manual > Learning Center > Learning Python > Conditional Statements and Loops > Values of Conditional Expressions |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
You can assign a conditional expression to a variable. If the expression is true, its value is 1. Otherwise, it is 0. For example:
Conversely, you can use almost any expression as a conditional expression. If its value is non-zero, it is evaluated as true. Otherwise, it is false. For instance:
The special values True and False can be used in conditional expressions. True is handy to use if you want to create a loop in which the test condition is in the middle. For example, here is a loop that displays the numbers from 1 to 10 but skips 5:
|