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.
TYPE Statement
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
Defines a data type containing one or more elements.
 
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.
 
Example:
    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