WRITE(*,*) exp1, exp2, ..., expn WRITE(*,*)
The first form starts with WRITE(*,*), followed by a list of arithmetic expressions or character strings, separated by commas. The computer will evaluate the arithmetic expressions and displays the results. Note that if a variable does not contain a value, its displayed result is unpredictable. The second form only has WRITE(*,*), which has a special meaning.
INTEGER :: Factor, N REAL :: Multiple, tolerance WRITE(*,*) Factor, N, Multiple, tolerance
CHARACTER(LEN=10) :: Title REAL :: Height, Length, Area WRITE(*,*) Title, (Height + Length) * Area
This example may produce the following result:INTEGER :: Target REAL :: Angle, Distance CHARACTER(LEN=*), PARAMETER :: Time = "The time to hit target " & IS = " is " & UNIT = " sec." Target = 10 Angle = 20.0 Distance = 1350.0 WRITE(*,*) 'Angle = ', Angle WRITE(*,*) 'Distance = ', Distance WRITE(*,*) WRITE(*,*) Time, Target, IS, Angle * Distance, UNIT
The blank line is generated by the third WRITE.Angle = 20.0 Distance = 1350.0 The time to hit target 10 is 27000sec.
There is nothing to worry about the output format. The computer will use the best way to display the results. In other words, integers and real numbers will be displayed as integers and real numbers. But, only the content of a string will be displayed. The computer will also guarantee that all significant digits will be shown so that one does not have to worry how many positions should be used for displaying a number. The consequence is that displaying a good-looking table is a challenge. This will be discussed in FORMAT statement.