User Guide

For example:
if false then
"if statement";
else
"else statement";
end if;
>
elif Clauses
In an if statement with elif clauses, Maple evaluates the conditional expres-
sions in order until one returns true. Maple executes the corresponding
statement sequence, and then exits the if statement. If no evaluation returns
true, Maple exits the if statement.
x := 11:>
if not type(x, integer) then
printf("%a is not an integer.", x);
elif x >= 10 then
printf("%a is an integer with more than one digit.", x);
elif x >= 0 then
printf("%a is an integer with one digit.", x);
end if;
>
11 is an integer with more than one digit.
Order of elif Clauses An elif clause's statement sequence is executed only
if the evaluation of all previous conditional expressions returns false or
FAIL, and the evaluation of its conditional expression returns true. This
means that changing the order of elif clauses may change the behavior of
the if statement.
In the following if statement, the elif clauses are in the wrong order.
324 8 Basic Programming