KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q36023: "Statement Illegal in TYPE block" Due to Line Identifier

Article: Q36023
Product(s): See article
Version(s): 4.00 4.00b 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | docerr B_BasicCom | mspl13_basic
Last Modified: 31-JAN-1990

Line labels and line numbers are not permitted within TYPE ... END
TYPE statement blocks. A "Statement illegal in TYPE block" error
message appears if this is attempted.

Under the TYPE ... END TYPE  statement (listed alphabetically) in the
"Microsoft QuickBASIC 4.0: BASIC Language Reference" manual for
QuickBASIC Versions 4.00 and 4.00b, in the "Microsoft QuickBASIC 4.5:
BASIC Language Reference" manual for QuickBASIC Version 4.50, and in
the "Microsoft BASIC Compiler 6.0: BASIC Language Reference" manual
for Microsoft BASIC Compiler Versions 6.00 and 6.00b, it needs to
mention that line identifiers are forbidden in TYPE ... END TYPE
statements.

This documentation omission has been corrected in the "Microsoft BASIC
7.0: Language Reference" for Microsoft BASIC Professional Development
System (PDS) Version 7.00 for MS-DOS and MS OS/2.

The BC.EXE compiler correctly gives the following error message in all
of the above products when you compile the code example farther below:

 10        partnumber AS STRING * 6
 ^ Identifier expected
 ^ Skipping forward to END TYPE statement
 DIM stockrecord AS stockitem
                    ^ TYPE not defined

Code Example
------------

'This gives "Statement illegal in TYPE block message,
'due to the presence of line identifiers.
TYPE stockitem
10        partnumber AS STRING * 6
          description AS STRING * 20
          unitprice AS SINGLE
abcd:     quantity   AS INTEGER
END TYPE
DIM stockrecord AS stockitem

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.