Logical operators

There are three logical operators you can use when building logical expressions. These are especially useful when you are using the IF function (see IF).

The following table lists the logical operators in their natural order of evaluation. If you combine either AND or OR with relational operators in an expression, Ability evaluates the relational operators before evaluating the AND or OR.

Operator

Meaning

&

AND

|

OR

~

NOT

For example:

Formula

Returns

2 * 3 > 7

FALSE

(2 * 3 > 7) | (4 * 1 = 4)

TRUE

(2 * 3 = 6) & ~(4 - (4 * 1))

TRUE

IF (cond1 & cond2 & cond3, truevalue, falsevalue)

If all conditions are met, truevalue

Using the logical operators is equivalent to using the logical functions as follows:

Formula

Function Equivalent

(2 * 3 > 7) | (4 * 1 = 4)

OR((2 * 3 > 7), (4 * 1 = 4))

(2 * 3 = 6) & ~(4 - 4 * 1)

AND((2 * 3 = 6), NOT(4 - 4 * 1))

IF (cond1 & cond2 & cond3, truevalue, falsevalue)

IF(AND(cond1, cond2, cond3), truevalue, falsevalue)

See also:

Logical functions

Arithmetical operators

Relational operators

Priority of evaluation of operators

Function reference