qbasic.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.
SHARED, STATIC Statements
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
SHARED gives procedures access to module-level variables.
STATIC makes a variable local to a function or procedure and preserves its
value between calls.
 
SHARED variable[()] [AS type] [,variable[()] [AS type]]...
STATIC variable[()] [AS type] [,variable[()] [AS type]]...
 
    ■ variable    The name of the module-level variable to share or variable
                  to make static. Variable names can consist of up to 40
                  characters and must begin with a letter. Valid characters
                  are A-Z, 0-9, and period (.).
    ■ AS type     Declares the data type of the variable (INTEGER, LONG,
                  SINGLE, DOUBLE, STRING, or a user-defined type).
 
Example:
    The program REMLINE.BAS illustrates using the SHARED and STATIC
    statements. To view or run this program, load REMLINE.BAS using the Open
    command from the File menu.
 
See Also    COMMON    DIM, REDIM