INTERPRET

 ────INTERPRET────expression────;──────────────

INTERPRET is used to process instructions that have been built dynamically by evaluating expression.

The expression is evaluated, and is then processed (interpreted) as though the resulting string was a line inserted into the input file (and bracketed by a DO; and an END;).

Any instructions (including INTERPRET instructions) are allowed, but note that constructions such as DO ... END and SELECT ... END must be complete. For example, a string of instructions being interpreted cannot contain a LEAVE or ITERATE instruction (valid only within a repetitive DO loop) unless it also contains the whole repetitive DO ... END construct.

A semicolon is implied at the end of the expression during processing, as a service to the user.

Example:

data='FRED'
interpret data '= 4'
/* Will a) build the string  "FRED = 4"         */
/*      b) execute  FRED = 4;                   */
/* Thus the variable "FRED" will be set to "4"  */

Example:

data='do 3; say "Hello there!"; end'
interpret data        /* Would display:         */
                      /*  Hello there!          */
                      /*  Hello there!          */
                      /*  Hello there!          */

Notes:


[Back: IF]
[Next: ITERATE]