Fortran II (1958) was recorded using line numbers, from what I can tell. For example, the first five columns of this IBM punch card are titled "statement number".

Punch card from a typical Fortran program by Arnold Reinhold Punch card from a typical Fortran program. Arnold Reinhold (https://en.wikipedia.org/wiki/File:FortranCardPROJ039.agr.jpg)

Columns 1 to 5 may be used to write numbers by which the statement may subsequently be referenced. (Fortran II General Information Manual. 1963. p. 7)

Was Fortran 2 the first programming language (or machine language) to be recorded using line numbers?

Line numbers are not a requirement for a programming language (or machine language), but they are of such practical importance that I am curious if there ever was a language recorded without them.

Obviously, if a program is read into addressable memory, each instruction has a memory address. This question is not about memory addresses, it is about the recorded form of the program, on the media on which the program is recorded at rest, e.g. a punch card.

  • 5
    The numbers in columns 1..5 are not line numbers, but labels, which in Fortran must be numerical. The numbers used for labels were pretty much arbitrary. – user58697 Dec 9 '15 at 19:29
  • 2
    Columns 1..5 were for statement labels, which had to be numbers. Columns 73..80 were for card sequence numbers. If you were unfortunate enough to drop your card deck, having sequence numbers on all of the cards meant that you could run your deck through a card sorter and get it back into the correct order. – John R. Strohm Dec 9 '15 at 20:46
  • 2
    The first DoS in computer history was to insert a punchcard into another student's deck containing 666 goto 666. Ok, the first one I got aware of. – ott-- Dec 9 '15 at 22:10

You are not going to find an antecedent to the first published computer program, written by Ada Lovelace for Babbage's difference engine, published in 1841.

Note that leftmost column, "Number of Operation".

I think that beats the other answers by a full century though perhaps it loses points for never having actually been run.


Probably Dartmouth BASIC (Beginner's All-purpose Symbolic Instruction Code), in 1964. In the original language, every line was required to have a line number, you could only put one statement on a line, and lines were "interpreted" (in a general sense: Dartmouth BASIC, while having a nice interactive user environment, was in fact compiler-based) in ascending order by line number.

  • 2
    Dartmouth BASIC, 1964, had numbered statements. Every statement had a number, in ascending order, but they did not have to be consecutive. Typical programs would initially use an increment of 10, leaving room for new statements between them. The numbers were used as labels for gotos, etc., and also were used for editing: to replace a statement, you simply typed in a replacement statement with the same number, and to delete one you typed the number with no text following. – Glenn Randers-Pehrson Dec 9 '15 at 20:56

The PAF compiler on CAB500 (written by my late father Dimitri Starynkevitch in 1958-1960; see this paper in Chiffres 1961) generated a line number for every line of code interactively typed (while a teenager, I played on a CAB500 in the Palais de la Découverte museum in Paris, near 1975?)

CAB500 was a drum based machine built in France. AFAIK, it was only sold in Europe (and mostly in France).

(so I am one of the few persons in the world involved in compilers -thru my GCC MELT tool- whose father also wrote compilers.)

  • Wah!! Extremely impressive, Basile. You very very fortunate to have such a father. – Mawg says reinstate Monica Dec 10 '15 at 11:16

My first computer was an IBM 1620 that used punched cards. It was produced in the late 1950's. When writing assembler (SPS) the first five columns of the card were for line number.

There was a practical use for those. If / when you dropped the cards you could take them to the sorter. Been there, done that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.