

If the program name is present then the word PROGRAM must also be present, and the name must match that in the PROGRAM statement (but case is not significant). The END statement may optionally be any of: Using square brackets to signify optional items, the syntax of the PROGRAM and END statements in Fortran 90 is of the form: A name can consist of up to 31 characters (letters, digits, or underscore), starting with a letter. The use of multiple-statement lines can, however, produce unreadable code, and should therefore be used only for simple cases, for example:Īlternative forms of the relational operators are now provided:Īll programs and subprogram have names. The semicolon is used as a statement separator, allowing multiple statements to appear on one line. WRITE(*,'UNIVERSITY OF MANCHESTER DEPARTMENT& If you split a string, though, you also need an ampersand at the start of the continuation line. Usually you will arrange the line break to be in a sensible place (like between two terms of a complicated expression), and then all that is needed is the & at the end of all lines except the last. The ampersand character, &, means `continued on the next line'. REAL :: length2 ! Length at end in mm (after cooling) REAL :: length1 ! Length at start in mm (room temperature) The rest of the line after the ! is ignored by the compiler. A comment can start anywhere on a source line and thus can be placed alongside the relevant code.

The exclamation mark introduces a comment. These are discussed in the following paragraphs.

Remember that the use of sensible names for variables helps readability.įortran 90 introduces new symbols, including the exclamation mark, the ampersand, and the semicolon, and the alternative form of relational operators. Identifier names can consist of between 1 and 31 alphanumeric characters (including the underscore), the only restriction being that the first must be a letter. A good convention is that the words which are not in your control are in upper case and names which you invent yourselves, such as variable names, are in lower case. The character set now includes both upper and lower case letters and the underscore. The source line may contain up to 132 characters. Using free source form, columns are no longer reserved and so Fortran statements can now appear anywhere on a source line. Fortran 90 Notes Sources, Types and Control Structures, QUB The Queen's University of Belfastįortran 90 supports two forms of source code the old Fortran 77 source code form (now called fixed form), and the new free form.
