up previous next
loop command
Repeat C Until B
Repeat C EndRepeat
where C is a sequence of commands and B is a boolean expression.
|
In the first form, the command sequence C is repeated until B
evaluates to FALSE. Unlike the
While command, C is executed at
least once. Note that there is no
EndRepeat following B. In the
second form, the command sequence C is repeated until a
Break or
Return is encountered within C.
Define GCD_Euclid(A, B)
Repeat
R := Mod(A, B);
A := B;
B := R;
Until B = 0;
Return A
EndDefine;
GCD_Euclid(6,15);
3
-------------------------------
N := 0;
Repeat
N := N+1;
PrintLn N;
If N = 5 Then Return; EndIf;
EndRepeat;
1
2
3
4
5
-------------------------------
|