Also, after column six Fortran does not recognize spaces (except for spaces inside quotations as in print statements). Many programmers for simplicity use all small letters, but you may do as you like. Columns 73-80 were originally used for numbering the punch cards, but are rarely used nowadays - leave them blank and the compiler will ignore them.įortran is case insensitive - that is, it does not distinguish between capital and small letters. Columns 7-72 contain the instructions of the program. Column 6 is used only to indicate a continuation of a line too long to fit on the card. Columns 2-5 (usually left blank) are reserved for line numbers. A "c" in column 1 indicates a comment (similar to REM in Basic). A punch card had 80 columns, and so does a line of Fortran code.
It is preferable to use a simple editor - such as Notepad or the DOS editor - because fancy word processors might add extraneous formatting notation that will hang up Fortran.Ī most peculiar feature of Fortran 77 is its line structure, which is a carryover from the old days when programs were typed on punch cards. To begin the process of creating a Fortran program in the math lab, you must open an editor. Instead, a program is typed and saved with an editor (i.e., a word processor), and the program is then turned into an executable file by a Fortran compiler. Unlike in Basic, a Fortran program is not typed in a "Fortran window". Moving from QuickBasic to Fortran is more a matter of change of terminology than anything else.
Even though this semester we have thus far studied Basic, at the same time we have studied Fortran, because commands and procedures are very similar in the two languages. (The number denotes the year of introduction.) Fortran 77 is probably still the most used, and it is the version installed on UHUNIX and in the UH math lab. There are several versions of Fortran around, among them Fortran 77, Fortran 90, and Fortran 95. The name Fortran originally referred to "Formula Translation", but it has long since taken on its own meaning. Part of the reason for Fortran's durability is that it is particularly well-suited for mathematical programming moreover, there are millions of useful programs written in Fortran, created at considerable time and expense, and understandably people are reluctant to trash these old programs and switch to a new programming language. Fortran Lesson 1 FORTRAN LESSON 1 Lesson Topicsįortran is one of the oldest programming languages devised, but it is also still one of the most popular, especially among engineers and applied scientists.