Boolean values

Variables of the type boolean can only have one of two possible values, namely TRUE or FALSE.

Boolean values are generated by logical operations. These are:

  • equal to (==)

  • not equal to (!=)

  • greater than (>)

  • smaller than (<)

  • smaller than or equal to (<=)

  • greater than or equal to (>=)

In addition, there is the logical negation (!) which reverses a Boolean value. This means it turns TRUE into FALSE an vice versa.

The following lines illustrate the usage of these operators:

Trace(TRACELEVEL_INFO, Str(0 == 1));

Trace(TRACELEVEL_INFO, Str(0 != 1));

Trace(TRACELEVEL_INFO, Str(0 < 0));

Trace(TRACELEVEL_INFO, Str(0 > 0));

Trace(TRACELEVEL_INFO, Str(0 <= 0));

Trace(TRACELEVEL_INFO, Str(0 >= 0));

This returns the following output:

False

True

False

False

True

True

The operations equal to and not equal to can be applied to all data types. Comparisons using smaller than or greater than only work for numbers, times, and strings.

It makes little sense to discuss all the possible operations with Boolean values at this point, and descriptions will therefore follow when they are needed, namely in chapter "Logical conjunctions".