QBasic 1.1: SHARED Statement
Explanation
SHARED, STATIC Statements
SHARED gives procedures access to module-level variables.
STATIC makes a variable local to a function or procedure and preserves its value between calls.
Worth knowing
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
Syntax
SHARED variable[()] [AS type] [,variable[()] [AS type]]... |
STATIC variable[()] [AS type] [,variable[()] [AS type]]... |
Description / Parameter(s)
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.