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.
Line Identifiers
◄Basic Program Line► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Line Identifiers
BASIC supports two types of line-identifiers: alphanumeric line labels
and line numbers.
Alphanumeric line labels
■ Consist of 1 to 40 letters and digits.
■ Must start with a letter and end with a colon.
■ Are not case sensitive.
■ Cannot consist of BASIC keywords.
■ Can have blanks and tabs between the label and the colon.
■ The following are examples of valid alphanumeric line labels:
ALPHA:
ScreenSub:
Alpha:
■ Special Notes:
- A GOTO statement is required when using alphanumeric line
labels as objects in IF...THEN statements:
IF A = 10 THEN GOTO IncomeData
Line numbers
■ Can range 0 to 65,529
■ The following are examples of valid line numbers:
1
200
300 PRINT "hello" '300 is the line number.)
6500
■ Special Notes:
- Using 0 is not recommended because:
- error-trapping and trapping statements such as ON
ERROR and ON event) interpret the line number 0, to
mean that trapping is disabled (stopped)
- RESUME 0 continues execution on the line where the
error occurred, not at line number 0
- Line numbers do not determine the order in which statements
are executed. For example, BASIC executes statements in the
following program in the order 100, 10, 5:
100 PRINT "The first line executed."
10 PRINT "The second line executed."
5 PRINT "The final line executed."
- Some older BASICs, such as BASICA, expect the lines to be in
numerical order: 5, 10, 100.
- If you are trapping errors, the ERL function returns only the
last line number located before the error.
Line Identifiers in General
■ They may begin in any column but must be first character in the line.
■ A line may have only one label.
■ BASIC does not require each line in a source program to have the
same type of identifier.
■ You may mix alphanumeric labels and line numbers in the same program,
and you may use alphanumeric labels as objects of any BASIC statement
where line numbers are permitted except as the object of an IF...THEN
statement.