Contents | Prev | Next

9.9 Repeat statement

Description

Repeat statements perform an action in a conditional loop until the loop condition is true, and include the following:

NOTE: The loop condition is evaluated after the statement-sequence is executed so the statement-sequence is executed at least once. Usually the statement-sequence will perform some action that will eventually cause the loop condition to be true and terminate the loop.

Example

For example, below is a very simple program which illustrates the use of the "repeat" statement.

   program ten(output);
   var
      count : 1..11;
   begin
      count := 1;
      repeat
         writeln(count);
         count := count + 1
      until count > 10
   end.

Syntax

(NOTE: for clarity some parts of the syntax are omitted, see Irie Pascal Grammar for the full syntax):

   repeat-statement = 'repeat' statement-sequence 'until' boolean-expression

   statement-sequence = statement { ';' statement }

Contents | Prev | Next