User Tools

Site Tools


eqv

Table of Contents

eqv

eqv is a logical-equivalence operator

syntax

result = numeric-expression1 eqv numeric-expression2

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

details

the eqv logical-equivalence operator compares two expressions and returns the boolean value true if both expressions are either true (non-zero) or false (zero). See the table below.

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

Logical operators are not to be confused with Bitwise Operators.

example

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

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

dim a, b: int = 0;

main do
  if a eqv b do
    print(true);
  else do
    print(false);
  end
end
Output:

-1

eqv.txt · Last modified: 2023/06/26 10:39 by admin