Begin

From Lazarus wiki
Revision as of 06:44, 17 October 2007 by Djzepi (talk | contribs)
Jump to navigationJump to search

The keyword begin is used to indicate the start of the executable section of a function, method of an object, procedure, program, property of an object, or is used to delineate the start of a block statement.

For a function, method, procedure, program, or property, it is used after all const, type and var declarations, and before the first executable statement. It is always terminated by an end statement:

<delphi>

 program Project1;
 var (..);
 begin
   (..);
 end.

</delphi>

For a block statement, it delineates the top of the block, and is also terminated by an end statement:

<delphi>

 if (..) then
   begin
     (..)
   end
 else
   begin
     (..)
   end;

</delphi>

A begin must be closed with end.


Keywords: begindoelseendforifrepeatthenuntilwhile