xor ( obj1 obj2 -- ? )
Factor handbook > The language > Booleans

Prev:or ( obj1 obj2 -- ? )


Vocabulary
kernel

Inputs and outputs
obj1a generalized boolean
obj2a generalized boolean
?a generalized boolean


Word description
If exactly one input is false, outputs the other input. Otherwise outputs f.

Notes
This word implements boolean exclusive or, so applying it to integers will not yield useful results (all integers have a true value). Bitwise exclusive or is the bitxor word.

Definition

: xor ( obj1 obj2 -- ? ) [ f swap ? ] when* ; inline