- 184.108.40.206. -
Table of Contents
2. TMT Pascal Language Description
2.2. Pascal Language Structure
220.127.116.11. Constant Declarations
There are two types of constants and TMT Pascal interprets them
Constants that are declared without a type may not be changed in the program.
Constants that are typed are the same as variables (described below),
however they contain an initial value. These constants may be changed in
the program. A constant declaration is preceded bythe const
identifier [:IdentifierType] = expression;
Identifier is the actual name of the constant defined.
IdentifierType, which is optional, specifies the type of the constant.
Again, if a type is specified, the constant is the same as a variable with
an initial value.
Expression is assigned to the constant and must be evaluated at
compile time. The following are untyped constants and may not be modified:
Digit = '0'..'9';
MaxSize = 100;
Msg = 'This is a string constant';
Typed constants may be of any type except for file, procedure, or function.
Some examples of typed constants are:
Coordinate = record
Originpos: Coordinate = (x:0; y:0);
Name : String = 'Hello World!';
StrSize : Integer = 100;
Ary : array [False..True] of Byte = (10,15);
Integer and Real Number Constants
- 18.104.22.168. -