An array constructor is an unnamed array.
Syntax:
( / constructor-values / )Where:constructor-values is a comma-separated list ofexpr or ac-implied-doexpr is an expression.
ac-implied-do is ( constructor-values, ac-implied-do-control )
ac-implied-do-control is do-variable = do-expr, do-expr [, do-expr]
do-variable is a scalar INTEGER variable.
do-expr is a scalar INTEGER expression.
An array constructor is a rank-one array. If a constructor element is itself array-valued, the values of the elements, in array-element order, specify the corresponding sequence of elements of the array constructor. If a constructor value is an implied-do, it is expanded to form a sequence of values under the control of the do-variable as in the DO Construct.
integer, dimension(3) :: a, b=(/1,2,3/), c=(/(i, i=4,6)/)
a = b + c + (/7,8,9/) ! a is assigned (/12,15,18/)
An array constructor can be reshaped with the RESHAPE intrinsic function and can then be used to initialize or represent arrays of rank greater than one. For example
real,dimension(2,2) :: a = reshape((/1,2,3,4/),(/2,2/))
assigns (/1,2,3,4/) to a in array-element order after reshaping it to conform with the shape of a.