If the top word on the stack is non-zero (i.e. "true") then duplicate it. More massively-useful than it would appear, since it allows stuff like:

: countdown ( n -- )
    begin ?dup while . 1- repeat cr ;
to print the numbers from n down; here if we'd used DUP instead of ?DUP, we'd have to DROP the extra value generated on a loop exit somewhere after the REPEAT.

Log in or register to write something here or to contact authors.