Sign in Join
Wiki copytemporary

Revision 2 of 3, by WikiArchive on 11-4-2026. The page as it is now.

End

The keyword end terminates an entity. It appears at several occasions:

For example:

pascal
procedure proc0;
    var
        a, b: integer;
    begin
        …
    end;

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

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

pascal
program proc1;
    var
        SL: TStrings;
    begin
        SL := TStringlist.create;
        try
            …
        finally
            SL.free;
        end;
    end.

end is used to indicate the end of the unit:

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

It also closes a record:

pascal
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: begin — do — else — end — for — if — repeat — then — until — while


From the Free Pascal wiki, page "End", as the Internet Archive kept it on 2022-10-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.