There are basically two ``flavors'' of for loops, similar to the MAPLE for loops:
for i := <expression1> to <expression2> by <expression3> do <statements> end for;
(if ``by <expression3> '' is omitted then
it automatically increments by
)
and
for s in S do <statements> end for;
For example,
> a:=0; > for i:=1 to 3 do a:=i+a; end for; > a; 6
and
> a:=0; > for i in [1..3] do a:=i+a; end for; > a; 6have the same effect.
In some cases, it appears that MAGMA wants you to type the ``for do'' statement on one line, the ``statements'' on the next line, and the ``end for'' on the last line. In other cases, having them all on one line is fine.