Difference between revisions of "End"
From Free Pascal wiki
Jump to navigationJump to searchLine 1: | Line 1: | ||
− | [[keyword]] | + | The '''end''' [[keyword]] closes a block of instructions started with the [[begin]] or [[case]] keyword, ends the declaration of [[field]]s of a [[record]], or closes a [[try]] .. [[finally]] or [[try]] .. [[except]] construct. |
− | + | ||
For example: | For example: | ||
− | ''' | + | '''procedure''' Proc1; |
'''var''' a,b: integer; | '''var''' a,b: integer; | ||
Line 9: | Line 9: | ||
'''begin''' | '''begin''' | ||
(..) | (..) | ||
− | '''end''' | + | '''end'''; |
+ | 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''' | '''var''' | ||
SL: TStrings; | SL: TStrings; | ||
Line 20: | Line 23: | ||
SL.Free; | SL.Free; | ||
'''end'''; | '''end'''; | ||
− | '''end''' | + | '''end'''. |
− | |||
− | |||
Revision as of 21:54, 10 May 2006
The end keyword closes a block of instructions started with the begin or case keyword, ends the declaration of fields of a record, or closes a try .. finally or try .. except construct.
For example:
procedure Proc1; var a,b: integer; begin (..) end;
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.
Keywords: begin — do — else — end — for — if — repeat — then — until — while