LOCAL-GLOBAL

Syntax:

LOCAL var#; LOCAL var$; LOCAL var[]
GLOBAL var#$

LOCAL defines variables for local use. That means the variable is only available in this SUB / the main program. You cannot acces them from anywhere outside and it releases memory after leaving the SUB.

GLOBAL accesses globlal varialbles with the same name as a LOCAL defined variable.

Sample:

LOCAL text$
GLOBAL text$="GLOBAL"
text$="LOCAL_MAIN"

GOSUB show
PRINT text$, 100, 150
SHOWSCREEN
MOUSEWAIT
END

// ------------------------------------------------------------- //
// -=#  SHOW  #=-
// ------------------------------------------------------------- //
SUB show:
LOCAL text$

// Creating and defining LOCAL arrays:
LOCAL array[]; DIM array[5]

text$="LOCAL_SUB"

PRINT text$, 100, 50
PRINT GLOBAL text$, 100, 100
ENDSUB // SHOW