result = x IMP y
Description
IMP returns the logical implication of two expressions. Logical implication returns TRUE if x implies y. IMP also does a bitwise comparison of two numeric expressions.
Table 13: Logical Implication
|
x |
y |
Implication |
|
TRUE/1 |
TRUE/1 |
TRUE/1 |
|
TRUE/1 |
FALSE/0 |
FALSE/0 |
|
FALSE/0 |
TRUE/1 |
TRUE/1 |
|
FALSE/0 |
FALSE/0 |
TRUE/1 |
Example
REM IMP Example
'IMP preforms logical and bitwiseimplication
DIM Test1, Test2, Test3, x, y
x = 3
y = 5
Test1 = x < 0 IMP y < 10
Test2 = x > 0 IMP y > 10
Test3 = x < 0 IMP y > 10
PRINT "Logical:"
PRINT " x < 0 IMP y < 10 = " & Test1
PRINT " x > 0 IMP y > 10 = " & Test2
PRINT " x < 0 IMP y > 10 = " & Test3
PRINT "Bitwise:"
PRINT " x IMP y = " & (x IMP y)
Output
Logical:
x < 0 IMP y < 10 = True
x > 0 IMP y > 10 = False
x < 0 IMP y > 10 = True
Bitwise:
x IMP y = -3
Related Items
AND, EQV, NOT, OR, XOR