and ( obj1 obj2 -- obj2/f ) (original) (raw)

Vocabulary
kernel

Inputs

obj1 a generalized boolean
obj2 a generalized boolean

Outputs

obj2/f 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

See also
and*

Definition