![](/images/backgrounds/286549/hp-sunsoft-pascal-4-0-users-manual-549395276x1.png)
A
| Comments |
| If the expression in %if expression %then is false, pc skips over the %then |
| part and executes the %elseif part instead. expression consists of a |
| conditional variable and the optional boolean operators, and, or, and not. |
| See the %else listing for examples of expression. |
| Example |
The Pascal program, |
|
program elseif_example(output); | |
elseif.p |
|
| { This program demonstrates the use of the |
| %if, %then, and %elseif directives. } |
| %var blue red |
| begin |
| %if blue %then |
| writeln('The color is blue.'); |
| %elseif red %then |
| writeln('The color is red.'); |
| %endif |
| end. { elseif_example } |
|
|
The output when you supply
The output when you supply
hostname% pc
The color is blue.
hostname% pc
The color is red.
The %elseifdef DirectiveThe %elseifdef directive provides an alternative action to the %ifdef directive.
252 | Pascal 4.0 User’s Guide |