Version: 1.0

The Xor operator is used to perform a logical exclusion on two expressions, where the expressions are Null, or are of Boolean subtype and have a value of True or False.

The Xor operator can also be used a "bitwise operator" to make a bit-by-bit comparison of two integers. If both bits are the same in the comparison (both are 0's or 1's), then a 0 is returned. Otherwise, a 1 is returned.

## Examples

##### Code:

```
<% =True Xor True %>
```

<% =True Xor False %>

<% =False Xor True %>

<% =False Xor False %>

##### Output:

`False`

True

True

False

#####
Language(s):
VBScript

##### Code:

```
<% expression1 = True %>
```

<% expression2 = False %>

<% =expression1 Xor expression2 %>

##### Output:

`True`

#####
Language(s):
VBScript

##### Code:

```
<%
```

Expression1 = 3

Expression2 = 5

Result = Expression1 Xor Expression2

Response.Write "Result = " Result

%>

##### Output:

`Result = 6`

##### Explanation:

In this example, the Xor performs a bitwise comparison on the 3 (in binary 011) and the 5 (in binary 101), and returns a 6 (in binary 110).

#####
Language(s):
VBScript

## See Also: