From Free Pascal wiki
Revision as of 12:16, 6 February 2021 by Trev (talk | contribs) (Fix typo)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

English (en)

A block is a sequence of declarations followed by a sequence of statements. The declarations are optional. The sequence of statements can be empty, but at least the beginend-frame has to be present (in routines asmend is allowed, too). The key feature of a block is, that declarations are only valid while the statements are processed. This concept is known as scope.


The following is a valid block:

	foobar = -1;
	booleanArray = array of boolean;
	check: booleanArray;
	check := booleanArray.create(true, false, true);

An indication, whether something constitutes a block, is, whether you can use it as part of a routine definition, as well as make a program out of it (syntactically; apart from the terminating dot).

See also