>R R> R@
>R ( n ---)
Transfers the value n from the top of the data stack to the top of the return stack.
This word is used in particular to temporarily store certain values that are difficult to
handle otherwise. However, care must be taken to restore the battery back to its initial state.
using the word R>
, this before leaving a definition or before the end of a
DO..LOOP
, DO..+LOOP
type loop.
Example:
: .bin ( n ---) base @ >R 2 base ! . R> base ! ;
Example of what not to do:
: TEST2 5 7 3 >R + . . ;
will crash your system when running.
Similarly:
: BOUCLE 5 0 DO >R LOOP R> ;
is also not recommended, crash guaranteed.
R> ( --- n)
The integer n is stripped from the return stack and placed on the data stack.
Example:
: .bin ( n ---) base @ >R 2 base ! . R> base ! ;
R@
Copies the value n at the top of the return stack to the top of the data stack.
Its action is equivalent to the sequence R> DUP> R
.