Language Reference Guide : Preprocessing Your 4GL Code : Preprocessor : The #define Statement
 
Share this page          
The #define Statement
The #define statement is used to create new macro variables and change the value of existing ones. It has the following syntax:
# define $variable [expr | bool_expr]
$variable
Specifies the name of the macro variable. The leading $ is required.
expr
Specifies the character or integer expression assigned to the macro variable. Character strings must be delimited with single quotation marks.
bool_expr
Specifies an expression that evaluates to TRUE or FALSE
For example, to define a macro variable, for a default color, you would use the following statement:
# define $defaultcolor 'CC_LIGHT_GRAY'
Guidelines for Using the #define Statement
The following rules apply to the #define statement:
The #define statement must be used by itself on one line.
If no expression is given for a macro variable in a #define statement, then the preprocessor creates a macro variable with no value.
Only one macro variable can be created in each #define statement.
If you #define a macro variable that already exists, then the existing macro variable is redefined with a new value. Therefore, the following statement is valid and increments $a:
#define $a $a+1
Multiple #defines of the same variable are permitted.
Character macro variables cannot contain embedded single quotation marks.