197
6000 CHK_IT:
6010 LOCAL X$,X; LET X$="CHECK X:"; PRINT X$,X
6020 LET X=X+10
6030 PRINT X$,X
6040 RETURN
7000 LOOP:
7010 PRINT "START LOOP, X=",X
7020 LET X$="LOOP" ! Not designated as LOCAL
7030 FOR LOCAL X=1 TO 4
7040 PRINT X$,X
7050 NEXT X
7060 RETURN
-:run
START TEST, X= 1234
CHECK X: 0
CHECK X: 10
TEST DONE
START LOOP, X= 1234
LOOP 1
LOOP 2
LOOP 3
LOOP 4
LOOP 1234 DONE
Variables in function definitions can be designated as local to prevent changes in
program variables:
0010 DEF FNXY(LOCAL X,LOCAL Y,LOCAL Z)=X+Y+Z
Format 2: Assign Local Arrays
LOCAL DIM array_name[$]
Use LOCAL with DIM to define an array name temporarily within a called procedure.
Once defined, subsequent uses of DIM to assign dimensions to the array will be
assumed to be local.
In Object Oriented Programming (OOP), array names are assigned local in the same
way as variables. The DIM directive is not required; e.g., LOCAL array_name[$].
Format 3: Define Local Properties in Object Oriented Programming
LOCAL prop1[OBJECT], prop2 [OBJECT]....
In Object Oriented Programming, the LOCAL directive can be used to define the
properties for an object class that are not exposed to external applications. They can
be accessed during the execution of program logic within the object class itself.
This format of the LOCAL directive is similar to the PROPERTY directive: variable
declarations may include dimensioned arrays and object references. LOCAL
properties are typically used for: