Enter the hour of the day 0-23 ? 7 Good Morning! Time for a coffee break. Don't forget the donut.
The PRINT statements in the true branch executed in sequence.
The true branch and the false branch
can get large.
The IF-THEN-ELSE-END IF
structure
may have branches containing many statements:
IF some test THEN true branch statement 1 true branch statement 2 . . . . . true branch statement 99 true branch statement 100 ELSE false branch statement 1 false branch statement 2 . . . . . false branch statement 49 false branch statement 50 END IF
A better way to think about this is the following:
IF some test THEN Task to perform when the test is true ELSE Task to perform when the test is false END IF
Computer programs
solve a problem by
breaking it into smaller tasks.
If the problem breaks into a choice of two small tasks,
use the
IF-THEN-ELSE-END IF
control structure.
Say that you have a problem that breaks into three tasks:
What does the design for the program look like?