[1] Programmers could also assign line numbers to statements in older programming languages, such as Fortran, JOSS, and BASIC.
[2] In Fortran, as first specified in 1956, line numbers were used to define input/output patterns, to specify statements to be repeated, and for conditional branching.
This was originally used for facilitating mechanical card sorting to assure intended program code sequence after manual handling.
Commands that were typed without a line number were executed immediately, in what JOSS referred to as "direct mode".
For instance, if a subroutine for calculating the square root of a number is in page 3, one might have three lines of code 3.1, 3.2 and 3.3, and it would be called using Do part 3.
Example: Introduced in 1964, Dartmouth BASIC adopted mandatory line numbers, as in JOSS, but made them integers, as in FORTRAN.
As defined initially, BASIC only used line numbers for GOTO and GOSUB (go to subroutine, then return).
One exception was allowing the pointer used by READ (which iterated through DATA statements) to be set to a specific line number using RESTORE.
It was a matter of programming style, if not outright necessity, in these languages to leave gaps between successive line numbers—i.e., a programmer would use the sequence (10, 20, 30, ...) rather than (1, 2, 3, ...).
Some BASICs had a RENUM command, which typically would go through the program (or a specified portion of it), reassigning line numbers in equal increments.
In "unstructured" programming languages such as BASIC, line numbers were used to specify the targets of branching statements.
It is a simple matter for a program to count the newlines in a source file and display an automatically generated line number as the location of the error.