contents.gifprev1.gifnext1.gif

BOOLEAN_EXPRESSIONS

In nu/TPU, all odd integers can be used to represent the Boolean value TRUE, and all even integers can be used to represent the Boolean value FALSE. This is different from some popular languages like 'C', where zero is FALSE, and any non-zero value is TRUE.

Thus the result of (7 AND 9) is 1 and TRUE. The result of (7 AND 10) is 2 and FALSE.

When executing a Boolean expression, nu/TPU evaluates expressions enclosed in parentheses before other elements. When using multiple operators (logical or otherwise) in one expression, you should use parentheses to ensure that the compiler evaluates expressions in the order you intend. For example, the following IF clause shows how to parenthesize an expression containing both logical and relational operators:

IF (x = 12) AND (y <> 40)