Repeat - until

Top  Previous  Next

The "repeat" statement has the form:

 

        repeat STATEMENT; ... STATEMENT until BOOLEAN EXPRESSION

 

The "repeat" loop is similar to the "while" loop except that the decision to continue the loop is made after the block.

 

These flow diagrams show the difference between the "while" and "repeat" statements:

 

 

An example of a repeat loop is:

 

        repeat  InputGuess;

                TestGuess

        until Guess = Number

 

Note that the command words "repeat" and "until" also act as "begin" and "end" for the block in the loop.