"Statement Illegal in TYPE block" Due to Line Identifier (36023)






This article was previously published under Q36023

SUMMARY

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.

MORE INFORMATION

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
				

Modification Type: Minor Last Reviewed: 1/8/2003
Keywords: KB36023