Sign in Join
Wiki copytemporary

End: what changed

Revision 2 to 3. 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:
1+The [[Keyword|keyword]] `end` terminates an entity. It appears at several occasions:
22
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]]
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]]
1313
14-For example:
15-```
14+For example:
15+
16+``` pascal
1617procedure proc0;
17- var
18- a, b: integer;
19- begin
20- …
21- end;
18+var
19+ a, b: integer;
20+begin
21+ …
22+end;
2223```
2324
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.
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.
2526
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-```
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):
28+
29+```delphi
2830program proc1;
29- var
30- SL: TStrings;
31- begin
32- SL := TStringlist.create;
33- try
34- …
35- finally
36- SL.free;
37- end;
38- end.
31+var
32+ SL: TStrings;
33+begin
34+ SL := TStringlist.create;
35+ try
36+ …
37+ finally
38+ SL.free;
39+ end;
40+end.
3941```
4042
41-`end` is used to indicate the end of the unit:
42-```
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-```
43+`end` is used to indicate the end of the unit:
6244
63-It also closes a [[Record|record]]:
64-```
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;
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.
7164```
7265
73-
74-**Keywords:** [[Begin|begin]] — [[Do|do]] — [[Else|else]] — end — [[For|for]] — [[If|if]] — [[Repeat|repeat]] — [[Then|then]] — [[Until|until]] — [[While|while]]
66+It also closes a [[Record|record]]:
7567
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;
75+```
76+
7677---
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).*
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).*

Back to history