Examples of basic repetitions
These examples show use of do-groups to achieve repetitive executions.
In the following example, the do-group is executed ten times, while
the value of the reference
I progresses from 1 through
10. do I = 1 to 10;
.
.
.
end;The effect of this DO and END statement is equivalent to the following:
I = 1;
A: if I > 10 then go to B;
.
.
.
I = I +1;
go to A;
B: next statementThe following DO statement executes the do-group three times—once
for each assignment of
'Tom', 'Dick',
and 'Harry' to Name. do Name = 'Tom', 'Dick', 'Harry';The following statement specifies that the do-group executes thirteen
times—ten times with the value of
I equal to
1 through 10, and three times with the value of I equal
to 13 through 15: do I = 1 to 10, 13 to 15;