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.
COMMON Statement
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
Defines global variables that can be shared throughout a program or between
chained programs.
 
COMMON [SHARED] variablelist
 
    ■ SHARED          Indicates that variables are shared with all SUB
                      or FUNCTION procedures.
    ■ variablelist    One or more variables to be shared:
 
                      variable[( )] [AS type] [, variable[( )] [AS type]]...
 
                      variable    A Basic variable name. Variable names can
                                  consist of up to 40 characters and must
                                  begin with a letter. Valid characters are
                                  A-Z, 0-9, and period (.).
                      type        The data type of the variable (INTEGER,
                                  LONG, SINGLE, DOUBLE, STRING, or a
                                  user-defined data type).
 
    ■ Unless it has been declared as a static array in a preceding DIM
      statement, an array variable in a COMMON statement is a dynamic array.
      Its dimensions must be set in a later DIM or REDIM statement.
 
See Also    CHAIN    DIM, REDIM    FUNCTION
            SHARED, STATIC           SUB