Download CIMPLICITY BCE Language Reference Manual
Transcript
Imp (operator) Syntax expression1 Imp expression2 Description Performs a logical or binary implication on two expressions. Comments If both expressions are either Boolean, Boolean variants, or Null variants, then a logical implication is performed as follows: and the second expression is True False Null True False Null True False Null If the first expression is True True True False False False Null Null Null then the result is True False Null True True True True Null Null Binary Implication If the two expressions are Integer, then a binary implication is performed, returning an Integer result. All other numeric types (including Empty variants) are converted to Long and a binary implication is then performed, returning a Long result. Binary implication forms a new value based on a bit-by-bit comparison of the binary representations of the two expressions, according to the following table: Example 1 Imp 1 = 1 Example: 0 Imp 1 = 1 5 01101001 1 Imp 0 = 0 6 10101010 0 Imp 0 = 1 Imp 10111110 This example compares the result of two expressions to determine whether one implies the other. Sub Main() a = 10 : b = 20 : c If (a < b) Imp (c < MsgBox "a is less Else MsgBox "a is less End If = 30 : d = 40 d) Then than b implies that c is less than d." than b does not imply that c is less than d." If (a < b) Imp (c > d) Then MsgBox "a is less than b implies that c is greater than d." Else MsgBox "a is less than b does not imply that c is greater than d." End If End Sub See Also GFK-1283G Operator Precedence (topic); Or (operator); Xor (operator); Eqv (operator); And (operator). I 11-3