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 ) -- ..a )


Vocabulary
kernel

Inputs
?a generalized boolean
truea quotation


Outputs
None

Word description
If cond is not f, calls the true quotation.

The cond value is removed from the stack before the quotation is called.

Examples
USING: kernel math prettyprint ; -5 dup 0 < [ 3 + ] when .
-2


Definition

: when ( ..a ? true: ( ..a -- ..a ) -- ..a ) [ ] if ; inline