18.3.3 bool
The bool-type data has the value true or false. There are the following relationships between the values true and false:
-
The !false value has the same meaning as the true value.
-
The !true value has the same meaning as the false value.
The keyword bool allows you to declare and initialize a bool-type variable or constant. You can use this keyword only in the DEFINE section. When you specify two or more variables after this keyword, use a comma (,) to delimit them.
You can declare a constant by using the keyword const in combination with the keyword bool. The values of the constants declared in the DEFINE section can only be referenced, and cannot be changed in the MAIN or ERROR section.
If a comparison expression evaluates to 0, the result is assumed to be true. If a comparison expression evaluates to a non-0 value, the result is assumed to be false.
- Organization of this subsection
(1) Format
DEFINE { [const] bool variable_name1 [= true|false] [, variable_name2 [= true|false] ] ; }
(2) Example of coding
DEFINE { bool sInvalidPathFlag, sDirectorySetFlag = true; bool SMemoryInsuff = false; bool sEndGUI = false; }
(3) Notes
-
A bool-type variable can be assigned a value of type integer or float. However, if data of type integer or float is assigned, because the value may become inaccurate, a warning message appears in the output window upon a syntax check.
-
All variables are initialized as false by default. In the example shown in (2) above, sInvalidPathFlag is initialized as false.