Constant Expressions A constant expression is an expression that the compiler can evaluate without executing the program in which it
occurs. Constant expressions include numerals; character strings; true constants; values of enumerated types; the
special constants True, False, and nil; and expressions built exclusively from these elements with operators,
typecasts, and set constructors. Constant expressions cannot include variables, pointers, or function calls, except
calls to the following predefined functions:
Abs High
Low Pred
Succ
Chr Length Odd Round
Swap
Hi
Lo
Ord SizeOf Trunc
This definition of a constant expression is used in several places in Delphi's syntax specification. Constant
expressions are required for initializing global variables, defining subrange types, assigning ordinalities to values in
enumerated types, specifying default parameter values, writing case statements, and declaring both true and typed
constants.
Examples of constant expressions:
100
'A'
256 - 1
(2.5 + 1) / (2.5 - 1)
'Borland' + ' ' + 'Developer'
Chr(32)
Ord('Z') - Ord('A') + 1