In free source form, statements are not limited to specific positions on a source line, and a line can contain from 0 to 132 characters.
Blank characters are significant in free source form. The following are rules for blank characters:
INTEGER NUM GO TO 40 20 DO K=1,8
The blanks are required after INTEGER, TO, 20, and DO.
|Optional Blanks||Required Blanks|
|BLOCK DATA||CASE DEFAULT|
|DOUBLE COMPLEX||DO WHILE|
|DOUBLE PRECISION||IMPLICIT type-specifier|
|ELSE IF||IMPLICIT NONE|
|END BLOCK DATA||INTERFACE ASSIGNMENT|
|END DO||INTERFACE OPERATOR|
|END FILE||MODULE PROCEDURE|
|END FORALL||RECURSIVE FUNCTION|
|END FUNCTION||RECURSIVE SUBROUTINE|
|END IF||RECURSIVE type-specifier FUNCTION|
|END INTERFACE||type-specifier FUNCTION|
|END MODULE||type-specifier RECURSIVE FUNCTION|
For information on statement separators (;) in all forms, see Section 2.3.
In free source form, the exclamation point character (!) indicates a comment if it is within a source line, or a comment line if it is the first character in a source line.
In free source form, the ampersand character (&) indicates a continuation line (unless it appears in a Hollerith or character constant, or within a comment). The continuation line is the first noncomment line following the ampersand. Although Fortran 90 permits up to 39 continuation lines in free-form programs, Compaq Fortran allows up to 511 continuation lines.
The following shows a continued statement:
TCOSH(Y) = EXP(Y) + & ! The initial statement line EXP(-Y) ! A continuation line
If the first nonblank character on the next noncomment line is an ampersand, the statement continues at the character following the ampersand. For example, the preceding example can be written as follows:
TCOSH(Y) = EXP(Y) + & & EXP(-Y)
If a lexical token must be continued, the first nonblank character on the next noncomment line must be an ampersand followed immediately by the rest of the token. For example:
TCOSH(Y) = EXP(Y) + EX& &P(-Y)
If you continue a character constant, an ampersand must be the first non-blank character of the continued line; the statement continues with the next character following the ampersand. For example:
ADVERTISER = "Davis, O'Brien, Chalmers & Peter& &son" ARCHITECT = "O'Connor, Emerson, and Davis& & Associates"
If the ampersand is omitted on the continued line, the statement continues with the first non-blank character in the continued line. So, in the preceding example, the whitespace before "Associates" would be ignored.
The ampersand cannot be the only nonblank character in a line, or the only nonblank character before a comment; an ampersand in a comment is ignored.
For More Information:
For details on the general rules for all source forms, see Section 2.3.