User Guide
The for clause must appear first.
The behavior of the for/in loop is:
1. Assign the first operand of expression to the name variable.
2. Execute the statement_sequence.
3. Assign the next operand of expression to variable.
4. Repeat steps 2 and 3 for each operand in expression. If there are no more
operands, exit the loop. (This is the loop bound test.)
Example
The following loop returns a floating-point approximation to the sin function
at the angles (measured in degree) in the list L.
L := [23.4, 87.2, 43.0, 99.7]:>
for i in L do
evalf(sin(i*Pi/180));
end do;
>
while Loop
The while loop repeats a statement sequence until a boolean expression does
not hold.
8.2 Flow Control • 329