next up previous contents
Next: The If Command Up: Decisions Previous: Nesting if-then-fi Commands

The elif Command

We can combine the previous two if-then-fi into a single if-then-fi with the addition of the elif (else if) command.

> x := 100:
> y := 34:
> if (x < y) then
>   lprint(x, ' is less than ', y);
> elif (x > y) then
>   lprint(x, ' is greater than ', y);
> else                                   # x must equal y
>   lprint(x, ' is equal to ', y);
> fi;
100  is greater than  34
We are allowed any number of elif conditions.



Gaston Gonnet
1998-09-15