Conditionals
Programs must frequently test if some condition holds, e.g. are two CDs in alphabetical order
Conditional statements have been invented to make tests
- If temp < 32 Then waterState = “frozen”
General form of basic conditional:
If <T/F expression> Then <assignment statement>
The meaning is that the <T/F expression> is evaluated
- If the outcome is true, then the assignment statement is performed
- If the outcome is false, then the assignment statement is skipped