when* ( ..a ? true: ( ..a ? -- ..a ) -- ..a )
Factor handbook > The language > Combinators > Conditional combinators

Prev:if* ( ..a ? true: ( ..a ? -- ..b ) false: ( ..a -- ..b ) -- ..b )
Next:unless* ( ..a ? false: ( ..a -- ..a x ) -- ..a x )


Vocabulary
kernel

Inputs and outputs
?a generalized boolean
truea quotation with stack effect ( ..a ? -- ..a )


Word description
Variant of if* with no false quotation.

The following two lines are equivalent:
X [ Y ] when* X dup [ Y ] [ drop ] if


Definition

: when* ( ..a ? true: ( ..a ? -- ..a ) -- ..a )
over [ call ] [ 2drop ] if ; inline