OPERATOR: Or
Implemented in version 1.0
Or
The Or operator is used to perform a logical disjunction on two
expressions, where the expressions are Null, or are of Boolean subtype
and have a value of True or False.
The Or operator can also be used a "bitwise operator" to make a bit-by-bit comparison of
two integers.
If one or both bits in the comparison are 1, then a 1 is returned.
Otherwise, a 0 is returned.
When using the Or to compare Boolean expressions, the order of the expressions is important.
Code:
<% =True Or True %>
<% =True Or False %>
<% =False Or True %>
<% =False Or False %>
<% =True Or Null %>
<% =Null Or True %>
<% =False Or Null %>
<% =Null Or False %>
<% =Null Or Null %>
Output:
True
True
True
False
True
True
(Null output)
(Null output)
(Null output)
In this example, the Or performs a bitwise comparison on the 1 (in binary 001)
and the 2 (in binary 010), and returns a 3 (in binary 011).
Code:
<%
Expression1 = 1
Expression2 = 2
Result = Expression1 Or Expression2
Response.Write "Result = " & Result
%>
Output:
Result = 3
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information
|