[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.226 repeat

Synopsis

 
repeat
  statement;
  ...
  statement;
until boolean expression;

Description

The `repeat ... until' statement declares a loop. For further description see section 8.1.7.7 repeat Statement.

Conforming to

`repeat' is defined in ISO-7185 Pascal and supported by all known Pascal variants.

Example

 
program RepeatDemo;
var
  Number, Sum: Integer;
begin
  WriteLn ('Black Jack for beginners.');
  WriteLn ('You can choose your cards yourself. :-)');
  Sum := 0;
  repeat
    Write ('Your card (number)? ');
    ReadLn (Number);
    Inc (Sum, Number);
    WriteLn ('You have ', Sum, '.')
  until Sum >= 21;
  if Sum = 21 then
    WriteLn ('You win!')
  else
    WriteLn ('You lose.')
end.

See also

section 8.1.7.6 while Statement, section 8.1.7.5 for Statement



This document was generated by Frank Heckenbach on May, 10 2002 using texi2html