Understanding constants
This is an introduction to constant definition.
A constant defines a read-only value identified by a name. A constant is similar to a variable, except that its value cannot be modified by program code.
A constant is defined with an identifier, and optional data type and a literal value.
Constants as typically used to define common invariable values that will be used at several place
in a
program:
CONSTANT PI DECIMAL(12,10) = 3.1415926,
MAX_SIZE INT = 10000,
ERRMSG = "PROGRAM ERROR: %1" -- type defaults to STRING
A good practice is to define constants that belong to the same domain in a single .4gl module,
define the constant as PUBLIC
, and import the module where the
constants are needed.