OR

The OR operator is used to perform a logical disjunction on two numbers.

Syntax

result = A ORB

Remarks

The OR operator performs a bit-wise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in Result according to the following truth table:

If bit in           And bit in            The result

Ais                 B is                     is

0                    0                         0

0                    1                         1

1                    0                         1

1                    1                         1

Although OR is a bit-wise operator, it is often used to test Boolean (True/False) conditions. 0 is false and any non-zero number is true. The predefined constant True = -1. The binary representation of -1 has all bits equal 1. Thus, any number OR -1 returns -1. Any number AND -1 returns the original number.

If A                 And                     Then

is                   B is                     Result is

-1                   Any Number         -1

-1                   NAN                    NAN

0                    Any Number         Number2

0                    NAN                    NAN

NAN = Not a number

Expressions that are evaluated to a number can be used in place of one or both of the numbers.