VBScript » Operators » Imp

Version: 1.0

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

The Imp 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 the same (both are 0's or 1's), then a 1 is returned. If the first bit is a 0 and the second bit is a 1, then a 1 is returned. If the first bit is a 1 and the second bit is a 0, then a 0 is returned.

Examples

Code:
<% =True Imp True %>
<% =True Imp False %>
<% =False Imp True %>
<% =False Imp False %>

<% =True Imp Null %>
<% =Null Imp True %>
<% =False Imp Null %>
<% =Null Imp False %>
<% =Null Imp Null %>
Output:
True
False
True
True

(Null output)
True
True
(Null output)
(Null output)
Explanation:

The order of the expressions is important.

Language(s): VBScript
Code:
<% AnyExpression = True %>
<% SomExpression = False %>
<% =AnyExpression Imp SomeExpression %>
Output:
False
Language(s): VBScript