FANDOM


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.

Use PUBLIC to define a variable available to the procedure in which it is defined and any procedures that procedure calls. 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

LOCAL "CURRENT.COLOR
MAKE "CURRENT.COLOR PC
SETPC 2
FD 30
SETPC :CURRENT.COLOR

END

Pc logo 35

This is a result of the procedure.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.