smart-if* ( pred true false -- )
Factor handbook » The language » Combinators » Smart combinators

Prev:smart-unless ( pred false -- )
Next:smart-when* ( pred true -- )


preda quotation
truea quotation
falsea quotation


Word description
A version of if that takes three quotations, where the first quotation is a predicate that preserves any inputs it consumes, the second is the true branch, and the third is the false branch. If the true branch is taken, the values are left on the stack and the quotation is called. If the false branch is taken, the number of inputs inferred from predicate quotation is dropped and the quotation is called.