Difference between revisions of "Repeat/fr"
From Free Pascal wiki
Jump to navigationJump to search (Use pascal highlighter) |
(fix language bar template transclusion, remove categorization done via transcluded page template, unify source code style) |
||
Line 1: | Line 1: | ||
− | {{ | + | {{Template:{{#titleparts:{{ROOTPAGENAME}}|1}}}} |
− | + | ||
Ce [[Keyword/fr|mot-clé]] est utilisé pour une construction itérative semblable à la boucle [[While/fr|while]] [[Do/fr|do]]. | Ce [[Keyword/fr|mot-clé]] est utilisé pour une construction itérative semblable à la boucle [[While/fr|while]] [[Do/fr|do]]. | ||
Syntax: | Syntax: | ||
− | <syntaxhighlight lang=pascal> | + | <syntaxhighlight lang="pascal"> |
repeat | repeat | ||
Line 16: | Line 16: | ||
Exemple: | Exemple: | ||
− | <syntaxhighlight lang=pascal> | + | <syntaxhighlight lang="pascal"> |
x := 1; | x := 1; | ||
repeat | repeat | ||
Line 29: | Line 29: | ||
{{Keywords/fr}} | {{Keywords/fr}} | ||
− | |||
− |
Latest revision as of 01:13, 6 September 2020
│
Deutsch (de) │
English (en) │
suomi (fi) │
français (fr) │
русский (ru) │
Ce mot-clé est utilisé pour une construction itérative semblable à la boucle while do.
Syntax:
repeat
<statement block>
until <condition>;
<statement block>: Une instruction simple ou une suite d'instructions, les begin-end sont inutiles car les instructions sont déjà délimitées par repeat et until.
<condition>: condition de terminaison de la boucle.
Exemple:
x := 1;
repeat
DoSomethingHere(x);
x := x + 1;
until x = 10
Elle diffère sur deux points d'avec la boucle while:
- la condition est évaluée après les instructions qui sont donc exécutées au moins une fois
- la boucle prend fin lorsque la condition est vérifiée (on parle de condition de terminaison)
Mots-clés: begin — do — else — end — for — if — repeat — then — until — while