Version: 1.0
The And operator is used to perform a logical conjunction on two expressions, where the expressions are Null, or are of Boolean subtype and have a value of True or False.
The And operator can also be used a "bitwise operator" to make a bit-by-bit comparison of two integers. If both bits in the comparison are 1, then a 1 is returned. Otherwise, a 0 is returned.
<% =True And True %>
<% =True And False %>
<% =False And True %>
<% =False And False %>
<% =True And Null %>
<% =Null And True %>
<% =False And Null %>
<% =Null And False %>
<% =Null And Null %>
True
False
False
False
(Null output)
(Null output)
False
False
(Null output)
When using the And to compare Boolean expressions, the order of the expressions is not important.
<% anyexpression = True %>
<% someexpression = False %>
<% =anyexpression And someexpression %>
False
<%
Expression1 = 1
Expression2 = 2
Result = Expression1 And Expression2
Response.Write "Result = " Result
%>
Result = 0
In this example, the And performs a bitwise comparison on the 1 (in binary 001) and the 2 (in binary 010), and returns a 0 (in binary 000).