Loop Statement

Repeats the statements enclosed between loop and end until an exit or a return statement is executed.

Syntax

Stat = "loop" StatSeq "end".

Example

dcltrans
transaction TCount
var
  i: number;
begin
  I := 0;
  loop
  if I >= 3 then exit end;
    I := I+1;
    write("hello world! "); write(I); writeln;
end;
end TCount

Output

hello world! 1
hello world! 2
hello world! 3