Testing Variable Set Status

A major GPP capability is to decide whether a variable is set on or off, and to take action accordingly. The following Boolean functions are available to support this:

VAR_SET(<var>)                        TRUE if <var> is set, FALSE if not

VAR_NOTSET(<var>)                  TRUE if <var> is not set, FALSE if it is

The variable argument for the function may be a simple variable or an array member. Full array variables cannot be used (each member has its own set flag).

Example

 VAR_SET(X), VAR_NOTSET(AR[12]), VAR_SET(AR[Y+1]) 

GPP2 will issue a compilation warning if the VAR_SET or VAR_NOTSET functions are used with non-modal variables (since this test is mostly useful for modal variables).

 GPP Compatibility Notes:

In the old GPP, testing that a variable is set on was done without such functions. It was enough to specify the name of that variable in the IF_SET condition, and GPP knew that the meaning was to the set status flag, not to the variable value. This is equivalent to using the VAR_SET function.

This backward-compatibility option is maintained in GPP2, and is further discussed in the relevant statement sections.

In the GPP2 programming language, a variable name is not a Boolean expression - it is a numeric or string expression (depending on the variable type). Proper use of the language requires the use of the VAR_SET and VAR_NOTSET functions. Building complex Boolean expressions is only possible with these functions.

Some functionality may be dependent on the product package. Contact your Reseller if you require a license.