Difference between revisions of "Repeat"
From Free Pascal wiki
Jump to navigationJump to search (Repeat does not need "begin" and "end;" and therefore deleted.) |
m |
||
Line 3: | Line 3: | ||
This [[Keyword|keyword]] is used in a control construct that is similar to a [[While|while]] [[Do|do]] loop. | This [[Keyword|keyword]] is used in a control construct that is similar to a [[While|while]] [[Do|do]] loop. | ||
− | Syntax | + | ==Syntax== |
− | + | <syntaxhighlight lang="pascal"> | |
− | + | repeat | |
− | + | <statement block> | |
+ | until <condition>; | ||
+ | </syntaxhighlight> | ||
− | <statement block>: A single pascal statement or a begin-end statement block. | + | * <statement block>: A single pascal statement or a begin-end statement block. |
+ | * <condition>: Expression that eveluates to a boolean value. | ||
− | + | ==Example== | |
− | + | <syntaxhighlight lang="pascal"> | |
− | + | x := 1; | |
− | + | repeat | |
− | + | DoSomethingHere(x); | |
− | + | x := x + 1; | |
− | + | until x = 10; | |
− | + | </syntaxhighlight> | |
Revision as of 18:37, 14 February 2018
Template:repeat
This keyword is used in a control construct that is similar to a while do loop.
Syntax
repeat
<statement block>
until <condition>;
- <statement block>: A single pascal statement or a begin-end statement block.
- <condition>: Expression that eveluates 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