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,

   PROGRAM Outie
    CHARACTER(LEN=*), PARAMETER :: long_name = &
              "Llanfairphwyll...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 PROGRAM Outie

produces on the screen,

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

Return to corresponding overview page gif

 

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,

Return to corresponding overview page gif


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

©University of Liverpool, 1997
Wed May 28 20:20:27 BST 1997
Not for commercial use.