# Bitwise Operators (LotusScript® Language)

An expression consisting of the bitwise operator Not and a numeric operand evaluates to an Integer or Long value (or to NULL if the operand is NULL). This number is the result of reversing the values of the bits in the binary representation of the operand (one's complement).

For example:

``````anInt% = 8
Print Bin\$(anInt%)
' Output: 1000
anotherInt% = Not anInt%
Print Bin\$(anotherInt%)
' Output: 11111111 11111111 11111111 11110111``````

An expression consisting of two numeric operands and a bitwise operator evaluates to an Integer or Long value (or to NULL if one of the operands is NULL). The rules that determine the data type of the result of a bitwise operation are:

• LotusScript® converts an EMPTY-valued operand to 0.
• LotusScript® rounds a floating-point operand to an integer. The data type of the operand is Long.
• If an operand is a date/time value, LotusScript® uses the numeric value of the date as the operand. The data type of the operand is Long.

The results of bitwise operations on two-operand expressions are:

Operator

If bit n in expr1 is

And bit n in expr2 is

Then bit n in the result is

And

0

0

0

0

1

0

1

0

0

1

1

1

Or

0

0

0

0

1

1

1

0

1

1

1

1

Xor

0

0

0

0

1

1

1

0

1

1

1

0

Eqv

0

0

1

0

1

0

1

0

0

1

1

1

Imp

0

0

1

0

1

1

1

0

0

1

1

1

For example:

``````anInt% = 10
anotherInt% = 5
Print Bin\$(anInt%)
' Output: 1010
Print Bin\$(anotherInt%)
' Output: 101
' Output: 11

theResult% = anInt% And anotherInt%
Print Bin\$(theResult%)
' Output: 0
Print Bin\$(theResult%)
' Output: 10

theResult% = anInt% Or anotherInt%
Print Bin\$(theResult%)
' Output: 1111
Print Bin\$(theResult%)
' Output: 1011

theResult% = anInt% Xor anotherInt%
Print Bin\$(theResult%)
' Output: 1111
Print Bin\$(theResult%)
' Output: 1001
theResult% = anInt% Eqv anotherInt%
Print Bin\$(theResult%)
' Output: 11111111 11111111 11111111 11110000
Print Bin\$(theResult%)
' Output: 11111111 11111111 11111111 11110110

theResult% = anInt% Imp anotherInt%
Print Bin\$(theResult%)
' Output: 11111111 11111111 11111111 11110101