qb45advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Sharing Variables
  Scoping Rules   Sharing Variables   Contents   Index
──────────────────────────────────────────────────────────────────────────────
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.