Fortran statements are either executable or non-executable. The compiler translates executable statements directly into a set of machine code instructions. Non-executable statements are mainly used to tell the compiler about the program; they are not directly translated into machine code. The END statement is executable and so are all those in the lowest right-hand box of the table below; all other statements are non-executable.
The general order of statements in a program unit is:
The table below shows the complete statement ordering rules: the statements listed in each box can be intermixed with those in boxes on the same horizontal level (thus PARAMETER statements can be intermixed with IMPLICIT statements) but those in boxes separated vertically must appear in the proper order in each program unit (thus all statement functions must precede all executable statements).
3|c|PROGRAM, FUNCTION, SUBROUTINE, BLOCK DATA | ||
IMPLICIT | ||
PARAMETER | Type statements: | |
INTEGER, REAL, DOUBLE PRECISION, | ||
COMPLEX, LOGICAL, CHARACTER | ||
Other specification statements: | ||
COMMON, DIMENSION, EQUIVALENCE, | ||
EXTERNAL, INTRINSIC, SAVE | ||
FORMAT | Statement function statements | |
DATA | Executable statements: | |
BACKSPACE, CALL, CLOSE, CONTINUE, DO, | ||
ELSE, ELSE IF, END IF, GO TO, IF, | ||
INQUIRE, OPEN, READ, RETURN, REWIND, | ||
STOP, WRITE, assignment statements. | ||
3|c|END |