# Imp Operator

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Used to perform a logical implication on two expressions. Syntaxresult=expression1Impexpression2. The Imp operator syntax has these parts:

PartDescription
resultRequired; any numeric variable.
expression1Required; any expression.
expression2Required; any expression.

Remarks The following table illustrates how result is determined:

If expression1 isAnd expression2 isThe result is
TrueTrueTrue
TrueFalseFalse
TrueNullNull
FalseTrueTrue
FalseFalseTrue
FalseNullTrue
NullTrueTrue
NullFalseNull
NullNullNull

The Imp operator performs a bitwise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following table:

If bit in expression1 isAnd bit in expression2 isThe result is
001
011
100
111

## Example

This example uses the Imp operator to perform logical implication on two expressions.

``````Dim A, B, C, D, MyCheck
A = 10: B = 8: C = 6: D = Null    ' Initialize variables.
MyCheck = A > B Imp B > C    ' Returns True.
MyCheck = A > B Imp C > B    ' Returns False.
MyCheck = B > A Imp C > B    ' Returns True.
MyCheck = B > A Imp C > D    ' Returns True.
MyCheck = C > D Imp B > A    ' Returns Null.
MyCheck = B Imp A    ' Returns -1 (bitwise comparison).
``````