Definitions

The sole purpose of a definition is to assign a value to a word and therefore make a script easier for a human to read. They do not use any bytecode space in a script. When a script is compiled the words are changed to their assigned value.

Syntax

define <n> = <value or expression>;
Parameter
Description

<n>

The name of the constant

<value or expression>

The value or expression assigned to the constant

The value of the definition must be possible to compute during compilation, meaning you can use math but not math functions.

Once a word is defined and given a value, that word can be used anywhere in the script where a value is valid, as shown below:

define my_value = 50;

main {
    if(get_val(XB1_LT)) {
        set_val(XB1_RT, my_value);
    }
}

If you wish to assign a value to a word and change its value during run time, you would use a variable instead of a define.

Last updated