| LOCAL | |
| Syntax | LOCAL name (LOCAL name1 name2 ...) |
| Explanation | LOCAL defines its input as a local variable whose value affects only the procedure in which it is called. The variable's previous value (if any) is saved at the beginning of the procedure where it is redefined and restored at the end of the procedure. The variable is only available within the procedure in which it is defined and in all other procedures which are called from within the procedure where the variable is defined.
To define a global variable, use MAKE without LOCAL. |
| Examples | MAKE "SKY "BLUE MAKE "GRASS "GREEN PONS SKY is BLUE GRASS is GREEN TO CHICKEN.LITTLE LOCAL "SKY MAKE "SKY "FALLING (PRINT [THE SKY IS] :SKY) END CHICKEN.LITTLE defined CHICKEN.LITTLE THE SKY IS FALLING PONS SKY is BLUE GRASS is GREEN The procedure below saves the current drawing color, draws a green line and then restores the current drawing color again. TO DRAW.IN.GREEN
|