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

Prev:?unless ( ..a default cond: ( ..a default -- ..a new/f ) false: ( ..a default -- ..a x ) -- ..a default/x )
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