? ( ? true false -- true/false )
Factor handbook » The language » Combinators » Conditional combinators

Prev:3guard ( ..a x y z quot: ( ..a x y z -- ..b ? ) -- ..b x/f y/f z/f )
Next:cond ( assoc -- )


Vocabulary
kernel

Inputs
?a boolean
truean object
falsean object


Outputs
true/falsean object


Word description
Chooses between two values depending on the boolean value of ?.

Examples
USING: io kernel math ; 3 4 < "3 is smaller than 4" "3 is not smaller than 4" ? print
3 is smaller than 4

USING: io kernel math ; 4 3 < "4 is smaller than 3" "4 is not smaller than 3" ? print
4 is not smaller than 3


Definition

: ? ( ? true false -- true/false ) rot [ drop ] [ nip ] if ;
inline