next up previous contents
Next: READ Statement Up: Simple Input / Output Previous: Simple Input / Output

 

PRINT Statement

This is the simplest form of directing unformatted data to the standard output channel, for example,

    CHARACTER(LEN=*), PARAMETER :: long_name = &
              "Llanphairphwyll...gogogoch"
    REAL :: x, y, z
    LOGICAL lacigol
    x = 1; y = 2; z = 3
    lacigol = (y .eq. x)
    PRINT*, long_name
    PRINT*, "Spock says ""illogical&
            &Captain"" "
    PRINT*, "X = ",x," Y = ",y," Z = ",z
    PRINT*, "Logical val: ",lacigol
    END

produces on the screen,

    Llanphairphwyll...gogogoch
    Spock says "illogical Captain"
    X =    1.000  Y =    2.000  Z =    3.000
    Logical val:  F

 

As can be seen from the above example, the PRINT statement takes a comma separated list of things to print, the list can be any printable object including user-defined types (as long as they don't contain pointers). The * indicates the output is in free (default) format. Fortran 90 supports a great wealth of output (and input) formatting which is not all described here!

There are a couple of points to raise,


next up previous contents
Next: READ Statement Up: Simple Input / Output Previous: Simple Input / Output

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 15:03:35 GMT 1996
Not for commercial use.