Sharing Variables
◄Scope Rules► ◄Variables► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Sharing Variables
You can share variables among parts of a module without making the variables
global by using the SHARED statement. For example, to share TabStops
without making it a global variable, you would add SHARED statements to the
particular procedures you want to share the variable:
DIM TabStops(MAXLINE)
.
.
.
SUB SetTabPos STATIC
SHARED TabStops()
.
.
.
END SUB
FUNCTION ThisIsATab(LastColumn AS INTEGER) STATIC
SHARED TabStops()
.
.
.
END FUNCTION
The SHARED statements indicate that the name TabStops in both procedures
refers to the same variable defined at the module level.