You are here: Function Reference > Alphabetical Listing > B > BitOr

BitOr

Use this function to return the result of a bitwise inclusive OR operation performed on two numeric values.

Syntax

BitOr(value1, value2)

Parameters specify the numeric values on which the bitwise OR operation is performed. If either parameter is not an integer, it will be converted to an integer before the bitwise OR operation is performed.

The bitwise inclusive OR operation compares each bit of value1 to the corresponding bit of value2. If either bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to zero (0). Note that integer values have 32 bits to compare.

The following table shows the result of a bitwise OR operation:

Value1 bit

Value2 bit

Result bit

0

0

0

0

1

 

1

 

1

1

 

1

Example

Here is an example:

x = 3 (3 is 0011 in binary)

y = 6 (6 is 0110 in binary)

 

z = BitOr(x,y)

z = 7 (7 is 0111 in binary)

See also