ADAPL constants
In an ADAPL program, a constant is a value that is included literally in the program text. In an expression such as a=b+10, 10 is a constant. Whatever happens in the program, a constant always keeps the same value. In contrast, the value of a variable may change. ADAPL allows three types of constants, corresponding with the three data types: integer, numeric, and text.
Adlib will recognize a string of digits without a decimal point as an integer constant. An integer constant may be preceded by a minus sign. If an integer notation occurs in a situation where a numeric is expected, the result will be a numeric constant. For example, in the instruction digit = 2, where digit is declared as a numeric value, 2 will be considered a numeric constant.
A series of digits with a decimal point and/or an exponent character (E or e) is seen by ADAPL as a numeric constant. The decimal notation may be preceded by a minus sign. With an E-notation (scientific notation) the decimal part (the mantissa) and the exponent may both be preceded by a minus sign. ADAPL treats numeric constants as floating point numbers.
A series of characters embedded in single quotes is treated as a text constant by ADAPL. If nothing is typed between the quotes (not even a space), what you have is an empty text, also called an empty string or a null string. This is particularly useful for initializing variables of the text type.
All characters in a particular character set can be included as part of a text constant. That includes accented characters, non-visible signs and reserved signs such as '/' and '*'. Single quotes and backward slashes can also be incorporated into a string, but then they must be doubled (this is called "escaping" of reserved characters). For example:
DISPLAY 'He said: ''Hello!''.'
* The literal quotes are doubled.
DISPLAY 'The path to Adlib is: C:\\Apps\\Adlib Software'
* The literal slashes (\) are doubled.
When these instructions are executed, the following will be displayed:
He said: 'Hello!'.
The path to Adlib is: C:\Applications\Adlib Software
One single quote can be displayed by using four consecutive quotes (see also Text expressions):
DISPLAY ''''
* The outer two quotes serve to denote a string is in
* between them. Of the inner two quotes the first marks the
* second to be interpreted literally; only the third quote
* of the four, will be shown.