Explanation
TYPE Statement
Defines a data type containing one or more elements.Worth knowing
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
TYPE usertype elementname AS typename [elementname AS typename] . . . END TYPE |
usertype | The name of the data type being defined. The name can consist of up to 40 characters and must begin with a letter. Valid characters are A-Z, 0-9, and period (.). |
elementname | An element of the user-defined data type. |
typename | The element's type (INTEGER, LONG, SINGLE, DOUBLE, STRING, or a user-defined data type). |
Use DIM, REDIM, COMMON, STATIC, or SHARED to create a variable of a user-defined data type. |
TYPE Card
Suit AS STRING * 9
Value AS INTEGER
END TYPE
DIM Deck(1 TO 52) AS Card
Deck(1).Suit = "Club"
Deck(1).Value = 2
PRINT Deck(1).Suit, Deck(1).Value
See also: | COMMON | DIM, REDIM | SHARED, STATIC |