Sign in Join
Wiki copytemporary

End/fr

Deutsch · English · Français · Suomi · Русский

Le mot-clé end termine un bloc d'instructions commencé par le mot-clé begin ou case, termine la déclaration des champs d'un enregistrement, ou ferme une construction try .. finally or try .. except. Il est aussi utilisé pour fermer une unité qui n'a pas de code d'initialisation.

Par exemple:

pascal
  procedure Proc1;
  
  var a,b: integer;
  
  begin
    (..)
  end;

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.

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):

pascal
   
  program Proc2;
  var
    SL: TStrings;
  begin
    SL := TStringlist.Create;
    try
      (..)
    finally
      SL.Free;
    end;
  end.

Pour une unité sans bloc d'initialisation, END est utilisé pour indiquer la fin de l'unité:

pascal
  unit detent;
  uses math;
 
  procedure delta(r:real);
 
  implementation
 
  procedure delta;
  begin
 
  ...
 
  end;
 
  ...
 
 (* Note: Pas d'instruction '''begin''' *)
 
  end.

Il ferme aussi un enregistrement:

pascal
 Type
   ExampleRecord = Record
                     Values: array [1..200] of real;
                     NumValues: Integer; { tient le nombre actuel de point dans le tableau }
                     Average: Real { tient la moyenne des valeurs dans le tableau }
                   End;

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.

Revision 2, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.