unless-zero ( ... n quot: ( ... n -- ... ) -- ... ) (original) (raw)
Vocabulary
math
Inputs
n | a number |
---|---|
quot | the 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