-->
LF Fortran 95

PRINT Statement

Description

The PRINT statement writes values from an output list to the console.

Syntax

PRINT format [, outputs]
Where:

format is one of:

([format-items]) label * assigned-label

format-items is a comma-separated list of [r]data-edit-descriptor, control-edit-descriptor, or char-string-edit-descriptor, or [r](format-items)

label is a statement label of a FORMAT statement.

assigned-label is a scalar default INTEGER variable that was assigned the label of a FORMAT statement in the same scoping unit.

outputs is a comma-separated list of expr or io-implied-do

expr is an expression.

io-implied-do is (outputs, implied-do-control)

implied-do-control is do-variable=start, end [, increment]

start, end, and increment are scalar numeric expressions of type INTEGER

do-variable is a scalar variable of type INTEGER

data-edit-descriptor is any valid format descriptor.

char-string-edit-descriptor is a CHARACTER literal constant

rep-chars is a string of characters

c is the number of characters in rep-chars

r, k, and n are positive INTEGER literal constants that are used to specify a number of repetitions of the data-edit-descriptor, char-string-edit-descriptor, control-edit-descriptor, or (format-items)

Remarks

The do-variable of an implied-do-control that is contained within another io-implied-do must not appear as the do-variable of the containing io-implied-do

If an array appears as an output item, it is treated as if the elements are specified in array-element order.

If a derived type object appears as an output item, it is treated as if all of the components are specified in the same order as in the definition of the derived type.

The comma used to separate items in format-items can be omitted between a P edit descriptor and an immediately following F, E, EN, ES, D, or G edit descriptor; before a slash edit descriptor when the optional repeat specification is not present; after a slash edit descriptor; and before or after a colon edit descriptor.

Within a CHARACTER literal constant, if an apostrophe or quotation mark appears, it must be as a consecutive pair without any blanks. Each such pair represents a single occurrence of the delimiter character.

Example

integer :: i=1,j=2,k=3 print *," i =",i," j =",j," k =",k print "(3i8)",i,j,k print 100,i,j,k 100 format(3i8)

See Also

FORMAT Statement