Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Line number
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===FORTRAN=== 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. For example:<ref>{{cite book|last1=Programming Research Department, International Business Machines Corporation|title=The FORTRAN Automatic Coding System for the IBM 704 EDPM: Preliminary Operator's Manual|date=April 8, 1957|pages=6β37|url=http://www.softwarepreservation.org/projects/FORTRAN/manual/Prelim_Oper_Man-1957_04_07.pdf}}</ref> <syntaxhighlight lang="fortran"> DIMENSION ALPHA(25), RHO(25) 1) FORMAT(5F12.4) 2) READ 1, ALPHA, RHO, ARG SUM = 0.0 DO 3 I=1, 25 IF (ARG-ALPHA(I)) 4,3,3 3) SUM = SUM + ALPHA(I) 4) VALUE = 3.14159*RHO(I-1) PRINT 1, ARG, SUM, VALUE GO TO 2 </syntaxhighlight> Like [[assembler language]] before it, Fortran did not assume every line needed a label (line number, in this case). Only statements referenced elsewhere required a line number: * Line 1 specifies a format pattern for input; the {{code|READ}} command in line 2 and the later {{code|PRINT}} command both reference this line. * The {{code|DO}} loop executes line 3. * The [[arithmetic IF]] statement branches to line 4 on a negative value, line 3 on zero, and again line 3 on a positive value. While the line numbers are sequential in this example, in the very first "complete but simple [Fortran] program" published the line numbers are in the sequence 1, 5, 30, 10, 20, 2.<ref name="Sayre_1956">{{cite book |title=The FORTRAN Automatic Coding System for the IBM 704 EDPM: Programmer's Reference Manual |publisher=Applied Science Division and Programming Research Department, [[International Business Machines Corporation]] |location=New York, USA |date=1956-10-15 |editor-first=David |editor-last=Sayre |editor-link=David Sayre |author-first1=John Warner |author-last1=Backus |author-link1=John Warner Backus |author-first2=R. J. |author-last2=Beeber |author-first3=Sheldon F. |author-last3=Best |author-first4=Richard |author-last4=Goldberg |author-link4=Richard Goldberg |author-first5=Harlan L. |author-last5=Herrick |author-first6=R. A. |author-last6=Hughes |author-first7=L. B. |author-last7=Mitchell |author-first8=Robert A. |author-last8=Nelson |author-first9=Roy |author-last9=Nutt |author-link9=Roy Nutt |author-first10=David |author-last10=Sayre |author-link10=David Sayre |author-first11=Peter B. |author-last11=Sheridan |author-first12=Harold |author-last12=Stern |author-first13=Irving |author-last13=Ziller |page=46 |url=http://archive.computerhistory.org/resources/text/Fortran/102649787.05.01.acc.pdf |access-date=2022-07-04 |url-status=live |archive-url=https://web.archive.org/web/20220704193549/http://archive.computerhistory.org/resources/text/Fortran/102649787.05.01.acc.pdf |archive-date=2022-07-04}} (2+51+1 pages)</ref> Line numbers could also be assigned to fixed-point variables (e.g., {{code|ASSIGN}} ''i'' {{code|TO}} ''n'') for referencing in subsequent assigned GO TO statements (e.g., {{code|GO TO}} ''n,(n1,n2,...nm)'').
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)