Or - Operator (Bit comparison OR)

Concerns

This operator performs a bitwise Or comparison between two expressions to the left and right of the operator.

Example

Dim V1 As Long, V2 As Long, V3 As Long

V1 := 7

V2 := 2

V3 := (V1 OR V2)

Result:

V3 contains the value 7

Declaration:

V1 contains a value from the set bits 1,2,3 = 1*2^0 + 1*2^1 + 1*2^2 = 1 + 2 + 4 = 7

V2 contains a value from the set bits 2 = 1*2^1 = 2

The logical comparison OR now adds up the set bits. These are bits 1,2,3, so the result is 1*2^0 + 1*2^1 + 1*2^2 = 1 + 2 + 4 = 7