= a(i,j-1) + a(i,j+1) + a(i-1,j) + a(i+1,j) b(i,j) = a(i,j) END FORALL The FORALL version is more readable. Assignment in a FORALL is like an array assignment: as if all the expressions were evaluated in any order, held in temporary storage, then all the assignments performed in any order. The first statement must fully complete before the second can begin. A FORALL may be nested, and may include a WHERE. Procedures referenced within a FORALL must be pure. Array elements For a simple case, given REAL, DIMENSION(100, 100) :: a we can reference a single element as, for instance, a(1, 1). For a derived-data type like TYPE fun_del REAL u REAL, DIMENSION(3) :: du END TYPE fun_del we can declare an array of that type: TYPE(fun_del), DIMENSION(10, 20) :: tar and a reference like tar(n, 2) is an element (a scalar!) of type fun_del, but tar(n, 2)%du is an array of type real, and tar(n, 2)%du(2) is an element of it. The basic rule to remember is that an array element always has a subscript or subscripts qualifying at least the last name. Array subobjects (sections) The general form of subscript for an array section is [lower] : [upper] [:stride] (where [ ] indicates an optional item) as in REAL a(10, 10) a(i, 1:n) ! part of one row a(1:m, j) ! part of one column a(i, : ) ! whole row a(i, 1:n:3) ! every third element of row a(i, 10:1:-1) ! row in reverse order a( (/ 1, 7, 3, 2 /), 1) ! vector subscript a(1, 2:11:2) ! 11 is legal as not referenced a(:, 1:7) ! rank two section Note that a vector subscript with duplicate values cannot appear on the left-hand side of an assignment as it would be ambiguous. Thus, b( (/ 1, 7, 3, 7 /) ) = (/ 1, 2, 3, 4 /) is illegal. Also, a section with a vector subscript must not be supplied as an actual argument to an OUT or INOUT dummy argument. Arrays of arrays are not allowed: tar%du ! illegal We note that a given value in an array can be referenced both as an element and as a section: a(1, 1) ! scalar (rank zero) a(1:1, 1) ! array section (rank one) depending on the circumstances or requirements. By qualifying objects of derived type, we obtain elements or sections depending on the rule stated