repeat
SYNTAX:
repeat statement1; statement2; ... until boolean_expression;
DESCRIPTION:
"repeat" is reserved word in all Pascal dialects for creating loops in the
program execution. The statements after the "repeat" executed
sequentially. When the "until" statement reached the execution continues
with the next statement if the boolean expression evaluates "true". If it
is "false" the execution continues at the next statement after the
starting "repeat" of the loop and the enclosed statements will be executed
again.
The statements in the loop will be executed at least once. If the
expression in the "until" statement always "false" the execution falls
into infinite loop.
It is allowed the create nested "repeat - until" loops where the closest
appearance of the keywords will define the individual loops. It is a
syntax error if the number of "repeat"-s and "until"-s are different in a
program block.
STANDARDS: All
EXAMPLE:
....
repeat { echo the input from "infile" to "outfile" }
readln(infile,buffer);
writeln(outfile,buffer);
until eof(infile);
close(infile); close(outfile);
....
This code is equivalent to the following:
label 10;
...
10 readln(infile,buffer);
writeln(outfile,buffer);
if not eof(infile) then goto 10;
close(infile); close(outfile);
...
SEE ALSO: for, while, do
_________________________________
Comment this please.
miklos