Line numbers are
While line numbers and labels serve the same purpose, their usage is slightly different. Line numbers are just a concession to compatibility with Interpretive BASIC. Line numbering can lead to bad programming style. Since the numbers themselves can be in any order, they give a false sense of structure to a program. We recommend that you avoid line numbers, and use labels instead.
Using labels instead of numbers allows you to make the flow of your program much more readable. For example:
GOSUB BuildQuarks
tells you much more than
GOSUB 1723
Each label must appear on a line by itself (though a comment may follow) and it serves to identify the statement immediately following it. Labels must begin with a letter and contain any number of letters, digits, and an underscore. Case is insignificant - THISLABEL, thislabel, and ThisLabel are all the same. A colon must follow a label, however, and statements that refer to the label must not include the colon.
MSGBOX "Now Sorting Invoices"
GOSUB SortInvoices
MSGBOX "All Done!"
EXIT FUNCTION
SortInvoices: ' This is a legal label
{sorting code goes here}
RETURN
The following is illegal, however:
ExitPoint: a = a + 1 ' a label must be on a line by itself
Finally, it should be noted that symbol names must be unique: a label may not share the name of any other symbol (Sub name, Function name, user-defined type or union definition, variable name, etc), and they are local to the Sub or Function in which they appear.
See Also