7. Variable declarations

Variable declarations introduce variables by defining an identifier and a data type for them.
VariableDeclaration = IdentList ":" Type.
Record and pointer variables have both a static type (the type with which they are declared - simply called their type) and adynamic type (the type of their value at run time). For pointers and variable parameters of record type the dynamic type may be an extension of their static type. The static type determines which fields of a record are accessible. The dynamic type is used to call type-bound procedures (see 10.2).

Examples of variable declarations (refer to examples in Ch. 6):

i, j, k: INTEGER
x, y: REAL
p, q: BOOLEAN
s: SET
F: Function
a: ARRAY 100 OF REAL
w: ARRAY 16 OF RECORD
name: ARRAY 32 OF CHAR;
count: INTEGER
END
t, c: Tree

Previous Section, Next Section, Contents
Adapted to HTML by Jürgen Geßwein; 12. Juni 1995