End/fr

From Lazarus wiki
Revision as of 08:13, 8 July 2014 by E-ric (talk | contribs) (Created page with "{{end}} <br> Le mot-clé '''end''' termine un bloc d'instructions commencé par le mot-clé begin ou case, termine la dé...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Deutsch (de) English (en) suomi (fi) français (fr) русский (ru)

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.

For example:

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

The end statement is one of the exceptions to the rule that every statement must be followed by a semicolon. The statement immediately preceding an end statement does not require a semicolon.

It is also used to end a pascal source file, in which case it is followed by a period rather than a semicolon (in the example below, the last semicolon is optional):

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

For a UNIT which contains no initialization, END is used to indicate the end of the unit:

  unit detent;
  uses math;
 
  procedure delta(r:real);
 
  implementation
 
  procedure delta;
  begin
 
  ...
 
  end;
 
  ...
 
 (* Note: No '''begin''' statement *)
 
  end.

It also closes a record:

 Type
   ExampleRecord = Record
                     Values: array [1..200] of real;
                     NumValues: Integer; { holds the actual number of points in the array }
                     Average: Real { holds the average or mean of the values in the array }
                   End;


Keywords: begindoelseendforifrepeatthenuntilwhile