[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
repeat Signals the Start of a REPEAT Loop
repeat
<statement>;
<statement>;
...;
<statement>
until <bool exp>;
The REPEAT loop executes a set of zero or more statements until <bool
exp> yields a TRUE value. If multiple statements are present, then
they are separated by semicolons. The last statement does not require
(but can have) a semicolon following it. A compound statement is never
required. The set of statements always executes at least once, since
<bool exp> is not tested until the end of the loop.
<statement> Any legal statement.
<bool exp> A Boolean expression, yielding TRUE or FALSE.
-------------------------------- Example ---------------------------------
I := 0;
repeat
J := I*I;
Writeln(I:2,J:4);
I := I + 1
until I > 10;
Number := 1 + Random(1000);
Tries := 0;
repeat
Write('Enter guess: ');
Readln(Guess);
Tries := Tries + 1;
if Guess < Number
then Writeln('Too low')
else if Guess > Number
then Writeln('Too high')
until (Tries = 10) or (Guess = Number);
See Also:
until
while
for
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson