Literals
ANSI
Literals are data strings (alpha, numeric, or a combination) that are not declared as variables. Literals are useful in programs where a constant value is needed. They may be in one of the following formats:
String - a sequence of characters - alpha, numeric and/or other special characters.
Character - a single character.
Number - a decimal integer number.
Ctrl - binary, decimal, hex or octal representation.
Character literals may be defined in any supported numbering base:
|
|
|
|
|
|
|
|
|
|
|
|
The following rules apply to string literals:
A string literal must be enclosed in quotes ("").
A string literal may be continued from one line to another by ending the first line with a pair of colons (::).
The Form Pointer is always one while the Length Pointer points to the last character.
String literals are generally the first OPERAND in most operations (excluding DISPLAY, KEYIN and PRINT operations). The OPERATION formats are described later.
The following examples show how String Literals may be OPERANDS:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ctrl literals must be between the values of 0 and 255 (decimal). Note the following examples:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The compiler optimizes the User Data Area by converting multiple literal representations of the same value into a single variable within the following guidelines: If the size of the literal is equal to or less than the label size for numeric variables or label size minus 1 for character strings (where the maximum label size is equal to 8 or your defined size), it is no longer more efficient to use:
|
|
|
|
|
|
|
|
|
|
|
|
As opposed to:
|
|
|
|
|
|
|
|
A literal may be continued on multiple lines:
|
|
|
|
|
|
|
|
See Also: Instruction Syntax
![]() |