up previous next
repeat

loop command

Syntax
Repeat C Until B

where C is a sequence of commands and B is a boolean expression.

Description
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, ending with EndRepeat is obsolescent from version 4.7.5, and can be trivially substituted with While True Do ...... EndWhile

Example
      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;
/**/  while true do 
        N := N+1;
        PrintLn N;
        if N = 5 then break; EndIf;
      EndWhile;
1
2
3
4
5

See Also