Eqv

From NSB App Studio
Revision as of 03:32, 4 July 2012 by Brendon (talk | contribs) (Created page with "'''Operator''' ''result = x EQV y'' '''Description''' EQV returns the logical equivalence of two expressions. ''result'' is TRUE, if both expressions ''x'' and ''y'' evalua...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Operator

result = x EQV y

Description

EQV returns the logical equivalence of two expressions. result is TRUE, if both expressions x and y evaluate to TRUE or both expressions x and y evaluate to FALSE, otherwise, result is FALSE.

EQV also does a bitwise comparison of two numeric expressions. Each bit in result is set to 1 if both corresponding bits in x and y are 1 or both corresponding bits in x and y are 0, otherwise it is set to 0.

Example

REM EQV Example
'EQV performs logical and bitwiseequivalence
DIM Test1, Test2, Test3, x, y
x = 4
y = 9
Test1 = x < 0 EQV y < 10
Test2 = x > 0 EQV y > 10
Test3 = x < 0 EQV y > 10
PRINT "Logical:"
PRINT "  x < 0 EQV y < 10 = " & Test1
PRINT "  x > 0 EQV y > 10 = " & Test2
PRINT "  x < 0 EQV y > 10 = " & Test3

Output

Logical:
  x < 0 EQV y < 10 = False
  x > 0 EQV y > 10 = False
  x < 0 EQV y > 10 = True

Related Items

[[and|AND], IMP, NOT, OR, XOR