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

Prev:and ( obj1 obj2 -- obj2/f )
Next:xor ( obj1 obj2 -- obj1/obj2/f )


Vocabulary
kernel

Inputs
obj1a generalized boolean
obj2a generalized boolean


Outputs
obj1/obj2a generalized boolean


Word description
If both inputs are false, outputs f. Otherwise outputs the first of obj1 and obj2 which is true.

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

Examples
Usually only the boolean value of the result is used, however you can also explicitly rely on the behavior that the result will be the first true input:
USING: kernel prettyprint ; t f or .
t

USING: kernel prettyprint ; "hi" 12.0 or .
"hi"


See also
or*, or?

Definition

: or ( obj1 obj2 -- obj1/obj2 ) dupd ? ; inline