User Guide

for counter from initial by increment to final
while conditional_expression do
statement_sequence
end do;
>
The general for/in loop has the following syntax.
for variable in expression
while conditional_expression do
statement_sequence
end do;
>
After testing the loop bound condition at the beginning of each iteration of
the for loop, Maple evaluates conditional_expression.
If conditional_expression evaluates to false or FAIL, Maple exits the
loop.
If conditional_expression evaluates to true, Maple executes statement_se-
quence.
Infinite Loops
You can construct a loop for which there is no exit condition, for example,
a while loop in which the conditional_expression always evaluates to true.
This is called an infinite loop. Maple indefinitely executes an infinite loop
unless it executes a break, quit, or return statement or you interrupt the
computation. For more information, refer to the ?break, ?quit, ?return,
and ?interrupt help pages.
Additional Information
For more information on the for statement and looping, refer to the ?do help
page.
332 8 Basic Programming