unless ( ..a ? false: ( ..a -- ..a ) -- ..a )
Factor handbook » The language » Combinators » Conditional combinators

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


Vocabulary
kernel

Inputs
?a generalized boolean
falsea quotation


Outputs
None

Word description
If cond is f, calls the false quotation.

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

Examples
USING: kernel math prettyprint sequences ; IN: scratchpad CONSTANT: american-cities { "San Francisco" "Los Angeles" "New York" } : add-tax ( price city -- price' ) american-cities member? [ 1.1 * ] unless ; 123 "Ottawa" add-tax .
135.3


Definition

: unless ( ..a ? false: ( ..a -- ..a ) -- ..a )
swap [ drop ] [ call ] if ; inline