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