| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
repeat statement; ... statement; until boolean expression; |
The `repeat ... until' statement declares a loop. For further description see section 8.1.7.7 repeat Statement.
`repeat' is defined in ISO-7185 Pascal and supported by all known Pascal variants.
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.
|
section 8.1.7.6 while Statement, section 8.1.7.5 for Statement