Constant is a code element, which value is set in the unit's descriptive part and remains constant during program execution.
All constants must be described in the separate section, which starts with the Const reserved work. The constant type is not specified. It will be defined automatically during the constant value analysis:
Const
<identifier> = <constant value>;
Fore has reserved constants with fixed vales. In the code these constants are highlighted as keywords.
Name | Constant description |
True | It returns logical True. |
False | It returns logical False. |
Null | It provides an empty reference that does not refer to any object. Setting it as a value causes resetting of the value and releasing resources spent to store value. Null as a value can be set for variables of one of the following types of data:
|
Const
_Name = "test.doc";
_Path = "c:\Work\";
_Max = 1000;
_Min = 0;
_Number = 86;
It is possible to determine a constant by expression calculation based on previously determined constants. The constants list given above can be continued:
Const
//...
Interval = _Max - _Min + 1;
Center = (_Max - _Min) / 2;
FullName = _Path + _Name;
All mathematical operators (+, -, /, *, div, mod), logical operators (not, or, and, xor), and relation operators may be used in expressions.
See also: