OR

The OR numerical operator returns a comparative bit value of 1 if either value's bit is on.

Syntax

result = firstValue OR secondValue

Description

• If both bits are off, it returns 0.
• If one or both bits are on then it returns 1.
• OR never turns off a bit and can be used only to turn a bit on.

The results of the bitwise logical operations, where A and B are operands, and T and F indicate that a bit is set or not set:
Operands Operations
A B NOT B A AND B A OR B A XOR B A EQV B A IMP B
T T F T T F T T
T F T F T T F F
F T F F T T F T
F F T F F F T T
Relational Operations return negative one (-1, all bits set) and zero (0, no bits set) for true and false, respectively.
This allows relational tests to be inverted and combined using the bitwise logical operations.

Examples

Example 1: OR always turns bits on! Never off.

a% = 5 ' 101 binary b% = 4 ' 100 binary results% = a% OR b% ' still 101 binary using OR PRINT "Results% ="; results%

Results% = 5

Example 2: Turning a data register bit on.