This keyword declares a boolean variable capable of encapsulating two possible values - in this case, TRUE (1) or
FALSE (0).
Local Boolean NAME
Local Boolean NAME(DIMENSIONS)
Variable Boolean NAME(DIMENSIONS)
Value Boolean NAME(DIMENSIONS)
Const Boolean NAME(DIMENSIONS)
NAME is the name of the declared variable.DIMENSIONS can be:
Several variable declarations can be done on the same line, separated by a comma.
Local declarations create the variables in the current local variable class that is not seen by nested or calling subprograms. The Call / Subprog and func / Funprog insulate the local variables as well as the calls of method by fmet.
Const, Variable, and Value declarations state the arguments sent by a Call, func, or fmet. With these syntaxes, the dimensions and the index ranges can be omitted wherever the parentheses are present. The dimension and index ranges are defined by the calling program.
Local Boolean BOOL : BOOL = TRUE
#A sub-program returning a True (1) value
Funprog RETURN_TRUE()
Local Boolean WT : WT = TRUE
END WT
#A sub-program returning a False (0) value
Funprog RETURN_FALSE()
Local Boolean WF : WF = FALSE
END WF
Boolean variables can be used to perform logical operations such as and, or, xor, and not.
| A | B | A and B |
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Example
Funprog AND_EXAMPLE(WA, WB)
Value Boolean WA
Value Boolean WB
End WA and WB
| A | B | A or B |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Example
Funprog OR_EXAMPLE(WA, WB)
Value Boolean WA
Value Boolean WB
End WA or WB
| A | B | A xor B |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Example
Funprog XOR_EXAMPLE(WA,WB)
Value Boolean WA
Value Boolean WB
End WA xor WB
It negates the original value of the boolean variable.
Example
Funprog NOT_EXAMPLE(WBOL)
Value Boolean WBOL
End not WBOL
The Boolean data type will implicitly convert Tinyint, Shortint, Integer, Double, Float, and Decimal data types to a boolean.
When Tinyint, Shortint, Integer, Double, Float, and Decimal data types are converted to a boolean:
Value zero (0) becomes FALSE.
A non-zero value becomes TRUE.
When a boolean is converted to Tinyint, Shortint, Integer, Double, Float, or Decimal data types:
FALSE becomes zero (0).
TRUE becomes one (1).
When the keywords TRUE and FALSE are assigned to Tinyint, Shortint, Integer, Double, Float, and Decimal data types:
FALSE becomes zero (0).
TRUE becomes one (1).
Global, Local, Variable, Value, Const, Tinyint, Libelle, Date, Shortint, Integer, Float, Double, Decimal, Char, Clbfile, Blbfile, Uuident, Datetime, Instance.