An array constructor is a sequence of specified scalar values. It constructs a rank-one array whose element values are those specified in the sequence.

>>-(/-- |

`ac_value`- is an expression or implied-
**DO**list that provides values for array elements. Each`ac_value`in the array constructor must have the same type and type parameters.If

`ac_value`is:- A scalar expression, its value specifies an element of the array constructor.
- An array expression, the values of the elements of the expression, in array element order, specify the corresponding sequence of elements of the array constructor.
- An implied-
**DO**list, it is expanded to form an`ac_value`sequence under the control of the`ac_do_variable`, as in the**DO**construct.

The data type of the array constructor is the same as the data type
of the `ac_value_list` expressions. If every expression in an
array constructor is a constant expression, the array constructor is a
constant expression.

You can construct arrays of rank greater than one using an intrinsic function. See RESHAPE(SOURCE, SHAPE, PAD, ORDER) for details.

INTEGER, DIMENSION(5) :: A, B, C, D(2,2) A = (/ 1,2,3,4,5 /) ! Assign values to all elements in A A(3:5) = (/ 0,1,0 /) ! Assign values to some elements C = MERGE (A, B, (/ T,F,T,T,F /)) ! Construct temporary logical mask ! The array constructor produces a rank-one array, which ! is turned into a 2x2 array that can be assigned to D. D = RESHAPE( SOURCE = (/ 1,2,1,2 /), SHAPE = (/ 2,2 /) ) ! Here, the constructor linearizes the elements of D in ! array-element order into a one-dimensional result. PRINT *, A( (/ D /) )

Implied-**DO** loops in array constructors help to create a
regular or cyclic sequence of values, to avoid specifying each element
individually.

A zero-sized array of rank one is formed if the sequence of values generated by the loop is empty.

>>-(--ac_value_list--,--implied_do_variable-- = --expr1--,--expr2--> >--+----------+--)--------------------------------------------->< '-,--expr3-'

`implied_do_variable`- is a named scalar integer or real variable.
In XL Fortran, an
`implied_do_variable`is a real expression. In a nonexecutable statement, the type must be integer. Loop processing follows the same rules as for an implied-**DO**in DATA, and uses integer or real arithmetic depending on the type of the implied-**DO**variable.The variable has the scope of the implied-

**DO**, and it must not have the same name as another implied-**DO**variable in a containing array constructor implied-**DO**:M = 0 PRINT *, (/ (M, M=1, 10) /) ! Array constructor implied-DO PRINT *, M ! M still 0 afterwards PRINT *, (M, M=1, 10) ! Non-array-constructor implied-DO PRINT *, M ! This one goes to 11 PRINT *, (/ ((M, M=1, 5), N=1, 3) /) ! The result is a 15-element, one-dimensional array. ! The inner loop cannot use N as its variable.

`expr1, expr2,`and`expr3`- are integer scalar expressions
**+-------------------------------IBM Extension--------------------------------+**

In XL Fortran, expr1, expr2 and expr3 are real expressions.

**+----------------------------End of IBM Extension----------------------------+**

PRINT *, (/ (I, I = 1, 3) /) ! Sequence is (1, 2, 3) PRINT *, (/ (I, I = 1, 10, 2) /) ! Sequence is (1, 3, 5, 7, 9) PRINT *, (/ (I, I+1, I+2, I = 1, 3) /) ! Sequence is (1, 2, 3, 2, 3, 4, 3, 4, 5) PRINT *, (/ ( (I, I = 1, 3), J = 1, 3 ) /) ! Sequence is (1, 2, 3, 1, 2, 3, 1, 2, 3) PRINT *, (/ ( (I, I = 1, J), J = 1, 3 ) /) ! Sequence is (1, 1, 2, 1, 2, 3) PRINT *, (/2,3,(I, I+1, I = 5, 8)/) ! Sequence is (2, 3, 5, 6, 6, 7, 7, 8, 8, 9). ! The values in the implied-DO loop before ! I=5 are calculated for each iteration of the loop.