Sign in Join
Wiki copytemporary

Block: what changed

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

Title: Block

OldNewLine
1+A **block** is a sequence of [[Declaration|declarations]] followed by a sequence of [[statement|statements]]. The declarations are optional. The sequence of statements can be empty, but at least the [[Begin|begin]]…[[End|end]]-[[Frame|frame]] has to be present (in [[Routine|routines]] [[Asm|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|scope]].
2+
3+## Example
4+
5+The following is a valid block:
6+
7+``` pascal
8+const
9+ foobar = -1;
10+type
11+ booleanArray = array of boolean;
12+var
13+ check: booleanArray;
14+begin
15+ check := booleanArray.create(true, false, true);
16+end;
17+```
18+
19+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|program]] out of it (syntactically; apart from the terminating dot).
20+
21+## See also
22+
23+- [[Comments|block comments]]
24+
25+---
26+*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](/wiki-contact).*
27+Category: Code
28+Category: Pascal

Back to history