10-06-2022, 11:34 PM
(09-28-2022, 05:03 AM)eoredson Wrote: btw; what is "as" without any preceding variable?I had forgotten to tell you a few days ago that a line beginning with "AS" has to be inside the definition of an UDT (User-Defined Type). This is to declare more than one field of the same type without extra typing. The same could be done with "DIM" (global) or "STATIC" (inside subprograms only) to declare multiple variables of the same type. For example:
DIM A AS INTEGER, B AS INTEGER, C AS INTEGER, D AS INTEGER
could be written as:
DIM AS INTEGER A, B, C, D
Inside an UDT, however, the "old" style forced multiple lines or colons to be used to declare multiple fields, even if they were of the same type. Consider this:
TYPE MYUDT
AS INTEGER A, B, C, D
END TYPE
instead of this:
TYPE MYUDT
A AS INTEGER
B AS INTEGER
C AS INTEGER
D AS INTEGER
END TYPE
which would have had to be typed in QuickBASIC or QBasic. The "new" style for UDT looks a bit confusing but it's meant to save time typing stuff. This is even more important if the program is subjected to "OPTION _EXPLICIT" in which every variable must be declared.