End/fr: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | - | ||
| 1 | + | Le [[Keyword/fr|mot-clé]] **end** termine un [[Block/fr|bloc]] d'instructions commencé par le mot-clé [[Begin/fr|begin]] ou [[Case/fr|case]], termine la déclaration des [[field/fr|champs]] d'un [[Record/fr|enregistrement]], ou ferme une construction [[Try/fr|try]] .. [[Finally/fr|finally]] or [[Try/fr|try]] .. [[Except/fr|except]]. Il est aussi utilisé pour fermer une [[Unit/fr|unité]] qui n'a pas de code d'initialisation. | |
| 2 | 2 | ||
| 3 | - | ||
| 4 | - | ||
| 5 | - | ||
| 6 | - | ||
| 7 | - | ||
| 8 | - | ||
| 9 | - | ||
| 10 | - | ||
| 11 | - | ||
| 3 | + | Par exemple: | |
| 4 | + | ||
| 5 | + | ``` pascal | |
| 6 | + | procedure Proc1; | |
| 7 | + | ||
| 8 | + | var a,b: integer; | |
| 9 | + | ||
| 10 | + | begin | |
| 11 | + | (..) | |
| 12 | + | end; | |
| 12 | 13 | ``` | |
| 13 | 14 | ||
| 14 | - | ||
| 15 | + | L'instruction *end* est l'une des exceptions à la règle qui veut que chaque instruction doit être suivie par un point-virgule. En effet, l'instruction précédant exactement l'instruction *end* ne requiert pas de point-virgule. | |
| 15 | 16 | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - | ||
| 19 | - | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - | ||
| 27 | - | ||
| 28 | - | ||
| 29 | - | ||
| 17 | + | Il termine aussi un fichier source Pascal, auquel cas il est suivi du point plutôt que du [[;|point-virgule]] (dans l'exemple ci-dessous, le dernier point-virgule est facultatif): | |
| 30 | 18 | ||
| 31 | - | ||
| 32 | - | ||
| 33 | - | ||
| 34 | - | ||
| 35 | - | ||
| 36 | - | ||
| 37 | - | ||
| 38 | - | ||
| 39 | - | ||
| 40 | - | ||
| 41 | - | ||
| 42 | - | ||
| 43 | - | ||
| 44 | - | ||
| 45 | - | ||
| 46 | - | ||
| 47 | - | ||
| 48 | - | ||
| 49 | - | ||
| 50 | - | ||
| 51 | - | ||
| 19 | + | ``` pascal | |
| 20 | + | ||
| 21 | + | program Proc2; | |
| 22 | + | var | |
| 23 | + | SL: TStrings; | |
| 24 | + | begin | |
| 25 | + | SL := TStringlist.Create; | |
| 26 | + | try | |
| 27 | + | (..) | |
| 28 | + | finally | |
| 29 | + | SL.Free; | |
| 30 | + | end; | |
| 31 | + | end. | |
| 52 | 32 | ``` | |
| 53 | 33 | ||
| 54 | - | ||
| 55 | - | ||
| 56 | - | ||
| 57 | - | ||
| 58 | - | ||
| 59 | - | ||
| 60 | - | ||
| 61 | - | ||
| 34 | + | Pour une unité sans bloc d'initialisation, END est utilisé pour indiquer la fin de l'unité: | |
| 35 | + | ||
| 36 | + | ``` pascal | |
| 37 | + | unit detent; | |
| 38 | + | uses math; | |
| 39 | + | ||
| 40 | + | procedure delta(r:real); | |
| 41 | + | ||
| 42 | + | implementation | |
| 43 | + | ||
| 44 | + | procedure delta; | |
| 45 | + | begin | |
| 46 | + | ||
| 47 | + | ... | |
| 48 | + | ||
| 49 | + | end; | |
| 50 | + | ||
| 51 | + | ... | |
| 52 | + | ||
| 53 | + | (* Note: Pas d'instruction '''begin''' *) | |
| 54 | + | ||
| 55 | + | end. | |
| 62 | 56 | ``` | |
| 63 | 57 | ||
| 64 | - | ||
| 65 | - | ||
| 58 | + | Il ferme aussi un [[Record/fr|enregistrement]]: | |
| 66 | 59 | ||
| 60 | + | ``` pascal | |
| 61 | + | Type | |
| 62 | + | ExampleRecord = Record | |
| 63 | + | Values: array [1..200] of real; | |
| 64 | + | NumValues: Integer; { tient le nombre actuel de point dans le tableau } | |
| 65 | + | Average: Real { tient la moyenne des valeurs dans le tableau } | |
| 66 | + | End; | |
| 67 | + | ``` | |
| 68 | + | ||
| 67 | 69 | --- | |
| 68 | - | ||
| 70 | + | *From the Free Pascal wiki, page "End/fr", as it stood on 2020-02-14 after a change by Trev, out of the wiki's dump of 2024-05-26. 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).* | |
| 71 | + | Category: Control Structures/fr | |
| 72 | + | Category: Pascal/fr |
