All Operators
And Operator
Or Operator
OPERATOR: Xor
Xor
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.
Code:
<% =True Xor True %>
<% =True Xor False %>
<% =False Xor True %>
<% =False Xor False %>
Output:
False
True
True
False
Code:
<% expression1 = True %>
<% expression2 = False %>
<% =expression1 Xor expression2 %>
Output:
True
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).
Code:
<%
Expression1 = 3
Expression2 = 5
Result = Expression1 Xor Expression2
Response.Write "Result = " & Result
%>
Output:
Result = 6
Copyright 1999-2004 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information