Difference between revisions of "Begin"
Line 1: | Line 1: | ||
{{Begin}} | {{Begin}} | ||
− | The [[ | + | The [[Reserved word|reserved word]] <syntaxhighlight lang="pascal" enclose="none">begin</syntaxhighlight> is used to indicate the start of the executable section of a [[Function|<syntaxhighlight lang="pascal" enclose="none">function</syntaxhighlight>]], [[Method|method]] of an [[Object|<syntaxhighlight lang="pascal" enclose="none">object</syntaxhighlight>]], [[Procedure|<syntaxhighlight lang="pascal" enclose="none">procedure</syntaxhighlight>]], [[Program|<syntaxhighlight lang="pascal" enclose="none">program</syntaxhighlight>]], [[Property|<syntaxhighlight lang="pascal" enclose="none">property</syntaxhighlight>]] 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 <syntaxhighlight lang="pascal" enclose="none">function</syntaxhighlight>, method, <syntaxhighlight lang="pascal" enclose="none">procedure</syntaxhighlight>, <syntaxhighlight lang="pascal" enclose="none">program</syntaxhighlight>, or <syntaxhighlight lang="pascal" enclose="none">property</syntaxhighlight>, it is used after all [[Const|<syntaxhighlight lang="pascal" enclose="none">const</syntaxhighlight>]], [[Type|<syntaxhighlight lang="pascal" enclose="none">type</syntaxhighlight>]] and [[Var|<syntaxhighlight lang="pascal" enclose="none">var</syntaxhighlight>]] declarations, and before the first executable statement. It is always terminated by an [[End|<syntaxhighlight lang="pascal" enclose="none">end</syntaxhighlight>]] statement: |
− | <syntaxhighlight> | + | <syntaxhighlight lang="pascal"> |
program Project1; | program Project1; | ||
var (..); | var (..); | ||
Line 13: | Line 13: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | For a block statement, it delineates the top of the block, and is also terminated by an end statement: | + | For a block statement, it delineates the top of the block, and is also terminated by an <syntaxhighlight lang="pascal" enclose="none">end</syntaxhighlight> statement: |
− | <syntaxhighlight> | + | <syntaxhighlight lang="pascal"> |
if (..) then | if (..) then | ||
begin | begin | ||
Line 26: | Line 26: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | A | + | A <syntaxhighlight lang="pascal" enclose="none">begin</syntaxhighlight> ''must'' be closed with [[End|<syntaxhighlight lang="pascal" enclose="none">end</syntaxhighlight>]]. |
{{Keywords}} | {{Keywords}} | ||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 16:23, 30 June 2019
│
Deutsch (de) │
English (en) │
español (es) │
suomi (fi) │
français (fr) │
русский (ru) │
中文(中国大陆) (zh_CN) │
The reserved word 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: begin — do — else — end — for — if — repeat — then — until — while