Boolean Expressions

A boolean expression is an expression which eventually evaluates to either True or False.

These are used as conditions inside Flow Control statements.

A boolean expression is built using the following:

> Greater than
>= Greater than or equal to
< Less than
<= Less than or equal to
= Equal to
<> Not equal to

These are used inside the flow control conditions e.g.

if a<b
...
end if

Combining Boolean Expressions

Boolean expressions can also be combined in the following ways...

if a<b and c<d
...
end if

In this example, the boolean expression only evaluates to true if a is less than b AND c is less than d.

if a<b or c<d
...
end if

In this example, the boolean expression only evaluates to true if a is less than b OR c is less than d.

A not operator is also available...

if not a=b
...
end if

This boolean expression only evaluates to true if a DOES NOT equal b. The not operator reverses the true/false value of a boolean expression.

Numeric expressions as booleans

Numeric expressions can also be placed inside conditions. They are evaluated like this:

0 - False
not 0 - True

e.g.

if a
...
end if

The body of the code will be executed as long as a does not equal 0.


Table of contents