drop
Pops the number on top of the integer stack and discards it.
Facts
- Word
drop- Aliases
dropint- Family
- Basic
- Integer stack
- pops 1, pushes 0
- What it does
- Pops the top and discards it. With an empty stack it does nothing.
- Cost
- Basic command
- Runs
- inside a gene: in the condition (cond) and in the body (start or else)
a b drop leaves a: it throws away the top one. You can also write dropint. With an empty stack it does nothing.
It is useful for cleaning up a leftover value that, if it stayed on the stack, would be taken by the next operator or the next gene (the integer stack passes from one gene to the next within the cycle, see The integer and boolean stacks).
cond
start
' stack: 5 7 drop stack: 5
5 7 drop 50 store
stopCell 50 ends up at 5: the 7 was discarded and the store used the 5.
To empty the whole integer stack at once there is clear, and to throw away the top of the boolean stack, dropbool.