next up previous contents index
Next: Continuation Lines Up: Program Structure and Layout Previous: Other Characters

Statements and Lines

The statement is the smallest unit of a Fortran program, corresponding to what is called an instruction or command in some programming languages. Most types of statement start with a keyword which consists of one (or sometimes two) English words describing the main action of that statement, for example: READ, DO, ELSE IF, GO TO. Since blanks are ignored, compound keywords can be written either as one word or two: ELSEIF or ELSE IF (but the latter seems easier to read).

The rules for statement layout   are an unfortunate relic of punched-card days. Every statement must start on a new line and each line is divided into three fixed fields:

Since labels and continuation markers are only needed on a few statements, the first six columns of most lines are left blank.

Any characters in column 73 or beyond are likely to be ignored (columns 73 to 80 were once used to hold card sequence numbers). This invisible boundary after column 72 demands careful attention as it can have very pernicious effects: it is possible for a statement to be truncated at the boundary but still be syntactically correct, so that the compiler will not detect anything wrong.



Mario Storti
Wed Nov 4 19:32:56 ART 1998