unless-zero ( ... n quot: ( ... n -- ... ) -- ... )
Factor handbook » The language » Numbers » Mathematical functions » Arithmetic functions

Prev:when-zero ( ... n quot: ( ... -- ... x ) -- ... x )
Next:sgn ( x -- n )


Vocabulary
math

Inputs
na number
quotthe second quotation of an if-zero


Outputs
None

Word description
Makes an implicit check if the number is zero. A zero is dropped. Otherwise, the quot is called on the number.

Examples
This word is equivalent to if-zero with an empty first quotation:
USING: sequences math prettyprint ; 3 [ ] [ sq . ] if-zero
9

USING: sequences math prettyprint ; 3 [ sq . ] unless-zero
9


See also
if-zero, when-zero, until-zero

Definition


: unless-zero ( ... n quot: ( ... n -- ... ) -- ... )
[ ] swap if-zero ; inline