Constants

Constants are the data elements, which values are defined in the unit descriptive part and remain constant.

All constants must be described in the separate section, which starts with the reserved word Const. The constant type is not specified. It will be defined automatically during the constant values analysis.

Format

Const

<identifier> = <constant value>;

Reserved Constants

The Fore language has a number of reserved constants with a fixed value. 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 on storing value. Null as a value can be set for variables of one of the following types of data:
  • System or custom object.
  • Interface.
  • Variant;
  • Array.
On an attempt to specify Null as the variable value of a simple data type, the exception is thrown.

Example

Const
    _Name = "test.doc";
    _Path = "c:\Work\";
    _Max = 1000;
    _Min = 0;
    _Number = 86;

The Fore language allows constants to be defined as expressions of numbers, some arithmetic functions, and previously defined constants. Thus, the following constants may be added into the previously described list:

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:

General Information