Table of Contents

imp

imp is a logical-implication operator

syntax

result = numeric-expression1 imp numeric-expression2

See also or, nor, not, xor, eqv, and

details

the imp logical-implication operator compares two expressions and returns the boolean value true if both expressions are true (non-zero) or false (zero), or if the first expression is false. See the table below.

expression 1    expression 2    result
    true            true         true
    true            false        false
    false           true         true
    false           false        true

Logical operators are not to be confused with Bitwise Operators.

example

In this example an implpication comparison is performed on two integer variables using an if-statement.

' SharpBASIC imp programming example
' ----------------------------------
incl "lib/sys.sbi";

dim a, b: int;

main do
  a = 0;
  b = 1;
  if a imp b do
    print(true);
  else do
    print(false);
  end
end
Output:

-1