Sign in Join
Wiki copytemporary

End: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-The [[Keyword|keyword]] `end` terminates an entity. It appears at several occasions:
2-
3-- to mark the end of a module, i.e. a [[Program|program]], [[Unit|unit]] or [[Library|library]]
4-- to conclude a [[Block|block]] of statements or instructions respectively
5- - either started by [[Begin|begin]], or
6- - started by [[Asm|asm]]
7-- to wrap up some language constructs:
8- - most prominently [[If and Then|if … then … end]], or
9- - [[Case|case]] … [[Of|of]] … `end`, but also
10- - [[Try, Except and Finally|try … except … finally … end]]
11-- to finish off certain [[Type|type]] declarations, such as [[Object|object]], [[Record|record]] and [[Class|class]]
12-- in [[Extended Pascal|extended Pascal]] `to end do …` starts the definition of the [[Finalization|finalization part of a module]]
1+The [[Keyword|keyword]] `end` terminates an entity. It appears at several occasions:
132
14-For example:
3+ * to mark the end of a module, i.e. a [[Program|`program`]], [[Unit|`unit`]] or [[Library|`library`]]
4+ * to conclude a [[Block|block]] of statements or instructions respectively
5+ * either started by [[Begin|`begin`]], or
6+ * started by [[Asm|`asm`]]
7+ * to wrap up some language constructs:
8+ * most prominently [[If and Then|`if … then … end`]], or
9+ * [[Case|`case`]] … [[Of|`of`]] … `end`, but also
10+ * [`try … except … finally … end`](</index.php?title=Try,_Except_and_Finally&action=edit&redlink=1> "Try, Except and Finally \(page does not exist\)")
11+ * to finish off certain [[Type|type]] declarations, such as [[Object|`object`]], [[Record|`record`]] and [[Class|`class`]]
12+ * in [[Extended Pascal|extended Pascal]] `to end do …` starts the definition of the [[Finalization|`finalization` part of a module]]
1513
16-``` pascal
14+For example:
15+```
1716procedure proc0;
18-var
19- a, b: integer;
20-begin
21- …
22-end;
17+ var
18+ a, b: integer;
19+ begin
20+ …
21+ end;
2322```
2423
25-The `end` gloss is one of the exceptions to the rule that every statement must be followed by a [[Semicolon|semicolon]]. The statement immediately preceding an `end` does not require a semicolon.
26-
27-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):
24+The `end` gloss is one of the exceptions to the rule that every statement must be followed by a [[Semicolon|semicolon]]. The statement immediately preceding an `end` does not require a semicolon.
2825
29-```delphi
26+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):
27+```
3028program proc1;
31-var
32- SL: TStrings;
33-begin
34- SL := TStringlist.create;
35- try
36- …
37- finally
38- SL.free;
39- end;
40-end.
29+ var
30+ SL: TStrings;
31+ begin
32+ SL := TStringlist.create;
33+ try
34+ …
35+ finally
36+ SL.free;
37+ end;
38+ end.
4139```
4240
43-`end` is used to indicate the end of the unit:
44-
45-``` pascal
46- unit detent;
47- uses math;
48-
49- procedure delta(r:real);
50-
51- implementation
52-
53- procedure delta;
54- begin
55-
56- ...
57-
58- end;
59-
60- ...
61- (* Note: No corresponding '''begin''' statement *)
62-
63- end.
41+`end` is used to indicate the end of the unit:
6442```
65-
66-It also closes a [[Record|record]]:
43+unit detent;
44+ uses math;
45+
46+ procedure delta(r:real);
47+
48+ implementation
49+
50+ procedure delta;
51+ begin
52+
53+ ...
54+
55+ end;
56+
57+ ...
58+ (* Note: No corresponding '''begin''' statement *)
59+
60+ end.
61+```
6762
68-``` pascal
69- Type
70- ExampleRecord = Record
71- Values: array [1..200] of real;
72- NumValues: Integer; { holds the actual number of points in the array }
73- Average: Real { holds the average or mean of the values in the array }
74- End;
63+It also closes a [[Record|record]]:
7564```
65+Type
66+ ExampleRecord = Record
67+ Values: array [1..200] of real;
68+ NumValues: Integer; { holds the actual number of points in the array }
69+ Average: Real { holds the average or mean of the values in the array }
70+ End;
71+```
7672
73+
74+**Keywords:** [[Begin|begin]] — [[Do|do]] — [[Else|else]] — end — [[For|for]] — [[If|if]] — [[Repeat|repeat]] — [[Then|then]] — [[Until|until]] — [[While|while]]
75+
7776---
78-*From the Free Pascal wiki, page "End", as it stood on 2020-06-24 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. 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](/wiki-contact).*
77+*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](/wiki-contact).*

Back to history