xor ( obj1 obj2 -- obj1/obj2/f )
Factor handbook » The language » Booleans

Prev:or ( obj1 obj2 -- obj1/obj2 )


Vocabulary
kernel

Inputs
obj1a generalized boolean
obj2a generalized boolean


Outputs
obj1/obj2/fa 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 -- obj1/obj2/f ) [ f swap ? ] when* ; inline