Difference between revisions of "Begin"

From Lazarus wiki
Jump to navigationJump to search
Line 1: Line 1:
 
{{Begin}}
 
{{Begin}}
  
The [[Keyword|keyword]] '''begin''' is used to indicate the start of the executable section of a [[Function|function]], [[Method|method]] of an [[Object|object]], [[Procedure|procedure]], [[Program|program]], [[property]] of an object, or is used to delineate the start of a [[block]] statement.  
+
The [[Keyword|keyword]] '''begin''' is used to indicate the start of the executable section of a [[Function|function]], [[Method|method]] of an [[Object|object]], [[Procedure|procedure]], [[Program|program]], [[Property|property]] of an object, or is used to delineate the start of a [[Block|block]] statement.  
  
 
For a function, method, procedure, program, or property, it is used after all [[Const|const]], [[Type|type]] and [[Var|var]] declarations, and before the first executable statement.  It is always terminated by an [[End|end]] statement:
 
For a function, method, procedure, program, or property, it is used after all [[Const|const]], [[Type|type]] and [[Var|var]] declarations, and before the first executable statement.  It is always terminated by an [[End|end]] statement:

Revision as of 22:27, 16 October 2015

Deutsch (de) English (en) español (es) suomi (fi) français (fr) русский (ru) 中文(中国大陆)‎ (zh_CN)

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:

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

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

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

A begin must be closed with end.


Keywords: begindoelseendforifrepeatthenuntilwhile