Next: Checkoff
Up: Conditionals
Previous: Basic IF Statements
IF statements are so simple and easy to use that there's not much more
to say about them. But take a look at ``if2.f'' (or view it
directly).
Run this program a few times to get a feel for how it works.
Here are several things that you should notice:
- An IF statement can consists of more than one alternative. After
the IF block, there can follow any number of ELSEIF blocks, followed
by an ELSE block.
- In any event, the entire IF statement always ends with exactly one
ENDIF/@. Notice that there are no ENDIF statements in the middle.
- The alternatives are considered from the top down. As soon as a
condition is found that is true, the statements grouped with that
alternative are executed and then control transfers to the end of the
IF statement. If none of the alternatives are true, the statements in
the ELSE block are executed.
Next: Checkoff
Up: Conditionals
Previous: Basic IF Statements
Hamlet Project
hamlet@cs.utah.edu