Block
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 begin…end-frame has to be present (in routines asm…end 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.
Example
The following is a valid block:
const
foobar = -1;
type
booleanArray = array of boolean;
var
check: booleanArray;
begin
check := booleanArray.create(true, false, true);
end;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
From the Free Pascal wiki, page "Block", as it stood on 2021-02-06 after a change by Trev, 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.