and ( obj1 obj2 -- ? )
Factor handbook » The language » Booleans

Prev:not ( obj -- ? )
Next:or ( obj1 obj2 -- ? )


Vocabulary
kernel

Inputs
obj1a generalized boolean
obj2a generalized boolean


Outputs
?a generalized boolean


Word description
If both inputs are true, outputs obj2. otherwise outputs f.

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

Examples
Usually only the boolean value of the result is used, however you can also explicitly rely on the behavior that if both inputs are true, the second is output:
USING: kernel prettyprint ; t f and .
f

USING: kernel prettyprint ; t 7 and .
7

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


Definition

: and ( obj1 obj2 -- ? ) over ? ; inline