XOR

Summary


xor is used to define an "or logical exclusive" between two logical values.

Syntax

    exp1 xor exp2

Parameters

Element

Description

Restrictions

exp1

Logical_expression

None.

exp2

Logical_expression

None.

Examples

   # Test : is I = 1 and J <> 2, or I <> 1 and J = 2 ?
    If I = 1 xor J = 2
       Infbox "One of the two conditions only is satisfactory"
    Endif

Description and comments

xor is used to obtain a logic result (0->false, 1->true) depending on the two logic expressions taking the value true (not null) or false (null), conforming to the truth table shown below :

exp1

exp2

exp1 xor exp2

FALSE
FALSE
TRUE
TRUE

FALSE
TRUE
FALSE
TRUE

FALSE (=0)
TRUE (=1)
TRUE (=1)
FALSE (=0)

Note :

When a formula containing a 'xor' is entered in a mask or a process, for example, the keyword identification phase will substitute the keyword with the character "?" which is equivalent; it can therefore then be written equally :
           exp1 xor exp2
or      exp1 ? exp2

Associated errors

Error

Description

ERMODE (10)

The arguments are not of the numeric type.

Associated keywords

AND - OR - NOT


SUMMARY


Copyright © Sage 1999 - 2007