Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://star.arm.ac.uk/f77to90/c3.html
Дата изменения: Sun Feb 11 17:24:48 1996 Дата индексирования: Mon Oct 1 20:58:04 2012 Кодировка: Поисковые слова: п п п п п п п п п п п п п |
Print *, 'This is a long output line',& ' this is the second part',& ' and this is the third part!'Nowadays, in the free form, we continue a line with the symbol "&" (called ampersand), i.e. with the sign & at the end of the old line instead of an almost arbitrary character in column 6 of the new line. With the compiler we are now using it is possible to include the Swedish characters in character strings and in comments.
Sometimes a certain identifier or a certain numerical number has not sufficient space on a line. We can then interrupt the identifier anywhere with the character "&" and then on the next line give a new "&" as the first non-blank character. You continue then directly from this "&" without any extra blank. The character "&" therefore works as a kind of delimiting or syllabification sign. You can write
PI = 3.141592653589793or you can write equivalently
PI = 3.14159265& &3589793Please note that comment lines can not be continued. The reason for this is that also in a comment line the sign "&" is treated as belonging to the comment. However, you can add comment lines also inside the continuation lines. Note that it is the final "&" of a line that informs of a continuation line, it is therefore possible to write a text string of characters including the character "&".
Sometimes you may wish to do it in the opposite way, to have several statements on the same line. This is being done with the use of semicolon and with the exclamation mark we can include a comment on the line.
A = 0.0 ; B = 1.0 ; C = 2.0 ! InitializationA line may include up to 132 characters, a statement up to 2640 characters, blanks included.
Note that on using the free form blanks are significant, as in my favourite example:
DO 25 I = 1. 25This gives a compilation error since the compiler does not find a comma between the lower and upper the limits, but the compressed version
DO25I=1.25gives the same result as the non-compressed form and as in Fortran 77 or using the old form (fix form) of Fortran 90, namely that the variable DO25I is being assigned the value 1.25.
Comments are started with "!" (exclamation mark) and ended with the end of line. The old types of comments introduced with C or * in column 1 are no longer permitted if you use free form, but of course if you use the fixed form. Upper case and lower case characters are equivalent except in character strings.
The above applies to the new free form. Also in the old, column -oriented or fixed form, we can use a semicolon or exclamation mark between columns 7 and 72 but you can not continue with "&" in columns 1 to 6 or 73 to 80 or write comments in columns 1 to 6. Exclamation mark in column 1 of course means a comment line also in the old fixed form. Some possibilities of longer lines do exist within the old fixed form (implementation dependent).
A = 0.0 ; B = 370 ! First variables ; C = 17.0 ; D = 33.0Solution.
(3.2) Are the following lines correct according to Fortran 90?
Y = SIN(MAX(X1,X2)) * EXP( - COS(X3)**I ) - TAN(AT& & AN(X4))Solution.