/* INTERPRET example */
data="FRED"
interpret data "= 4"
/* Builds the string "FRED = 4" and */
/* Processes: FRED = 4; */
/* Thus the variable FRED is set to "4" */
/* Another INTERPRET example */
data="do 3; say "Hello there!"; end"
interpret data /* Displays: */
/* Hello there! */
/* Hello there! */
/* Hello there! */
TRACE R or
TRACE I
can be helpful in interpreting the results you get.
/* Here is a small Rexx program. */
Trace Int
name="Kitty"
indirect="name"
interpret 'say "Hello"' indirect'"!"'
3 *-* name="Kitty"
>L> "Kitty"
>>> "Kitty"
4 *-* indirect="name"
>L> "name"
>>> "name"
5 *-* interpret 'say "Hello"' indirect'"!"'
>L> "say "Hello""
>V> INDIRECT => "name"
>O> " " => "say "Hello" name"
>L> ""!""
>O> "" => "say "Hello" name"!""
>>> "say "Hello" name"!""
5 *-* say "Hello" name"!"
>L> "Hello"
>V> NAME => "Kitty"
>O> " " => "Hello Kitty"
>L> "!"
>O> "" => "Hello Kitty!"
>>> "Hello Kitty!"
Hello Kitty!
INDIRECT), and
another literal string. The resulting pure character string is then interpreted,
just as though it were actually part of the original program. Because it is
a new clause, it is traced as such (the second
*-* trace flag under
line 5) and is then processed. Again a literal string is concatenated to the
value of a variable (NAME) and another literal,
and the final result (Hello Kitty!) is then
displayed.say "Hello" value(indirect)"!"