Difference between revisions of "Repeat"
From Free Pascal wiki
Jump to navigationJump to search (clean up syntax) |
|||
Line 1: | Line 1: | ||
{{Repeat}} | {{Repeat}} | ||
− | + | The [[Reserved word|reserved word]] {{HL|repeat}} is used as a [[loop instruction]] where the test occurs after the loop is executed. It is a control construct that is similar to a [[While|{{HL|while}}]]-[[Do|{{HL|do}}]] loop. | |
==Syntax== | ==Syntax== | ||
Line 11: | Line 11: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | * <statement block>: | + | * <statement block>: One or more [[Pascal]] [[statement]]s. The {{HL|repeat}}-{{HL|until}} construct is a [[Block|block]] statement, so a [[Begin|{{HL|begin}}]]-[[End|{{HL|end}}]] statement block is not required. |
* <condition>: [[expression|Expression]] that evaluates to a [[Boolean|<syntaxhighlight lang="pascal" enclose="none">boolean</syntaxhighlight>]] value. | * <condition>: [[expression|Expression]] that evaluates to a [[Boolean|<syntaxhighlight lang="pascal" enclose="none">boolean</syntaxhighlight>]] value. | ||
Revision as of 00:10, 15 October 2020
│
Deutsch (de) │
English (en) │
suomi (fi) │
français (fr) │
русский (ru) │
The reserved word repeat
is used as a loop instruction where the test occurs after the loop is executed. It is a control construct that is similar to a while
-do
loop.
Syntax
repeat
<statement block>
until <condition>;
- <statement block>: One or more Pascal statements. The
repeat
-until
construct is a block statement, so abegin
-end
statement block is not required. - <condition>: Expression that evaluates to a
boolean
value.
Example
x := 1;
repeat
DoSomethingHere(x);
x := x + 1;
until x = 10;
Keywords: begin — do — else — end — for — if — repeat — then — until — while