Repeat/fr: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | - | ||
| 2 | - | ||
| 3 | - | ||
| 4 | - | ||
| 5 | - | ||
| 1 | + | Ce [[Keyword/fr|mot-clé]] est utilisé pour une construction itérative semblable à la boucle [[While/fr|while]] [[Do/fr|do]]. | |
| 6 | 2 | ||
| 7 | - | ||
| 8 | - | ||
| 9 | - | ||
| 3 | + | Syntax: | |
| 10 | 4 | ``` | |
| 11 | - | ||
| 12 | - | ||
| 5 | + | repeat | |
| 6 | + | <statement block> | |
| 7 | + | until <condition>; | |
| 8 | + | ``` | |
| 13 | 9 | ||
| 14 | - | ||
| 10 | + | <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_. | |
| 15 | 11 | ||
| 16 | - | ||
| 12 | + | <condition>: condition de terminaison de la boucle. | |
| 17 | 13 | ||
| 18 | - | ||
| 19 | - | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - | ||
| 14 | + | Exemple: | |
| 24 | 15 | ``` | |
| 16 | + | x := 1; | |
| 17 | + | repeat | |
| 18 | + | DoSomethingHere(x); | |
| 19 | + | x := x + 1; | |
| 20 | + | until x = 10 | |
| 21 | + | ``` | |
| 25 | 22 | ||
| 26 | - | ||
| 23 | + | Elle diffère sur deux points d'avec la boucle while: | |
| 27 | 24 | ||
| 28 | - | ||
| 29 | - | ||
| 25 | + | * la condition est évaluée après les instructions qui sont donc exécutées au moins une fois | |
| 26 | + | * la boucle prend fin lorsque la condition est vérifiée (on parle de condition de terminaison) | |
| 30 | 27 | ||
| 28 | + | ||
| 29 | + | **Mots-clés:** [[Begin/fr|begin]] — [[Do/fr|do]] — [[Else/fr|else]] — [[End/fr|end]] — [[For/fr|for]] — [[If/fr|if]] — repeat — [[Then/fr|then]] — [[Until/fr|until]] — [[While/fr|while]] | |
| 30 | + | ||
| 31 | 31 | --- | |
| 32 | - | ||
| 32 | + | *From the Free Pascal wiki, page "Repeat/fr", as the Internet Archive kept it on 2025-01-18, last changed on 2020-09-06. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
