The logical operators operate on Boolean (logical) values.
&
AND
If both sides of an AND operator are TRUE
, the Boolean value TRUE
is returned; otherwise FALSE
is returned.
Note that if the left-hand side of an AND operator in an expression is FALSE
, the right-hand side is not evaluated.
!
unary NOT
The NOT operator returns the logical negation of the expression.
¦
OR (note that this is usually shift-\ on the keyboard)
If either side of an OR operator is TRUE
, the Boolean value TRUE
is returned; otherwise FALSE
is returned.
Note that if the left-hand side of an OR operator in an expression is TRUE
, the right-hand side is not evaluated.
In Fireworkz, Boolean values and numeric values are freely convertible:
When numeric values are used in operations that require Boolean values,
Fireworkz always maps the number zero to the Boolean value FALSE
and any non-zero number to the Boolean value TRUE
.
When Boolean values are used in operations or calculations that require numeric values,
Fireworkz always maps the Boolean value FALSE
to the number 0
(zero)
and TRUE
to the number 1
(one).
Logical operators are often used to construct the condition required by the IF
function. The following function adds the contents of cells A2
and B2
only if the contents of both cells A1
and B1
match the specified criteria:
IF(A1=6 & B1=4, SUM(A2, B2), 0)