Xor operator (LotusScript® Language)

Performs a logical exclusion on two expressions.

Syntax

expr1 Xor expr2

Elements

expr1, expr2

Any expressions. Their values must lie within the range for Long values.

Usage

The following table explains how LotusScript® determines the result of the Xor operation.

expr1

expr2

Result

TRUE

TRUE

FALSE

TRUE

FALSE

TRUE

FALSE

TRUE

TRUE

FALSE

FALSE

FALSE

TRUE

NULL

NULL

NULL

TRUE

NULL

FALSE

NULL

NULL

NULL

FALSE

NULL

NULL

NULL

NULL

In addition to performing a logical exclusion, the Xor operator compares identically positioned bits in two numeric expressions (known as a bit-wise comparison) and sets the corresponding bit in the result according to the following table.

Bit n in expr1

Bit n in expr2

Bit n in result

1

1

0

1

0

1

0

1

1

0

0

0

Example

' Boolean usage
Dim johnIsHere As Boolean, jimIsHere As Boolean
Dim oneButNotBothIsHere As Boolean
johnIsHere = TRUE
jimIsHere = FALSE
oneButNotBothIsHere = johnIsHere Xor jimIsHere
Print oneButNotBothIsHere         ' Prints True

' Bit-wise usage
Dim z As Integer, y As Integer
z% = &b11110000
y% = &b11001100
Print Bin$(z% Xor y%)              ' Prints 111100