Imp Operator

Performs a logical implication on two expressions.

Syntax:


Result = Expression1 Imp Expression2

Parameters:

Result: A numeric variable that will contain the result of the implication.

Expression1, Expression2: Expressions that you want to evaluate with the Imp operator.

If you use the Imp operator in Boolean expressions, False is only returned if the first expression evaluates to True and the second expression to False.

If you use the Imp operator in bit expressions, a bit is deleted from the result if the corresponding bit is set in the first expression and the corresponding bit is clear in the second expression.

Example:


Sub ExampleImp
Dim A As Variant, B As Variant, C As Variant, D As Variant
Dim vOut As Variant
    A = 10: B = 8: C = 6: D = Null
    vOut = A > B Imp B > C ' returns -1
    vOut = B > A Imp B > C ' returns -1
    vOut = A > B Imp B > D ' returns 0
    vOut = (B > D Imp B > A) ' returns -1
    vOut = B Imp A ' returns -1
End Sub

Please support us!