Language:
Русский
English
Constant declarations (const: reserved word)
A constant declaration (const) defines an identifier that denotes a constant value within the block containing the declaration. A constant identifier cannot be included in its own declaration.
Syntax
const
identifier = expression;
...
identifier = expression;
Remarks
Expressions used in constant declarations must be written such that the compiler can evaluate them at compile time.
Turbo Pascal allows constant expressions as an extension to standard Pascal.
Typed constant declarations are used to declare initialized variables. Unlike an untyped constant, the declaration of a typed constant specifies both the type and the value of the constant. Typed constants can be modified just like variables.
Examples
(* Constant Declarations *)
const
MaxData = 1024 * 64 - 16;
NumChars = Ord('Z') - Ord('A') + 1;
Message = 'Hello world...';
const
identifier: type = value;
...
identifier: type = value;