Next: IGNORE and REMEMBER, Previous: NEXT FORGET and RESUME, Up: Statements [Index]
INTERCAL-72 | C-INTERCAL | CLC-INTERCAL | J-INTERCAL |
---|---|---|---|
yes | all versions | all versions | all versions |
The NEXT stack is not the only stack available in an
INTERCAL program; each variable used in the program
also has its own stack, which holds values of the same type as the
variable. The STASH
command pushes a variable’s
value onto that variable’s stack; RETRIEVE
can be
used in the same way to pop the top element of a variable’s stack
to replace that variable’s value. The syntax is the same as most
other INTERCAL commands, with the word
STASH
or RETRIEVE
followed by the variable or
variables to stash or retrieve:
DO STASH .1 + ;2 DO RETRIEVE ,3
Note that it is possible to stash or retrieve multiple variables at
once, by listing their names separated by intersections
(+
); it’s even possible to stash or retrieve a
variable twice in the same statement.
It is not entirely clear how RETRIEVE
interacts with
IGNORE
in historical INTERCAL-72 compilers;
the three modern INTERCAL compilers all use
different rules for the interaction (and the C-INTERCAL
maintainers recommend that if anyone decides to write their own
compiler, they choose yet another different rule so that looking at the
interaction (the so-called ‘ignorret test’) can be used as
a method of determining which compiler is running):
RETRIEVE
simply allows a change to its value despite the
read-only status.
The appropriate gerunds for STASH
and
RETRIEVE
are STASHING
and
RETRIEVING
respectively.
Next: IGNORE and REMEMBER, Previous: NEXT FORGET and RESUME, Up: Statements [Index]