the case of a function, the shape of the result is the shape of the array arguments. Most intrinsic functions are elemental and Fortran 95 extends this feature to non-intrinsic procedures, thus providing the effect of writing, in Fortran 90, 22 different versions, for ranks 0-0, 0-1, 1-0, 1-1, 0-2, 2-0, 2-2, ... 7-7, and is further an aid to optimization on parallel processors. An elemental procedure must be pure. ELEMENTAL SUBROUTINE swap(a, b) REAL, INTENT(INOUT) :: a, b REAL :: work work = a a = b b = work END SUBROUTINE swap The dummy arguments cannot be used in specification expressions (see above) except as arguments to certain intrinsic functions (BIT_SIZE, KIND, LEN, and the numeric inquiry ones, (see below). WHERE Often, we need to mask an assignment. This we can do using the WHERE, either as a statement: WHERE (a /= 0.0) a = 1.0/a ! avoid division by 0 (note: the test is element-by-element, not on whole array), or as a construct: WHERE (a /= 0.0) a = 1.0/a b = a ! all arrays same shape END WHERE or WHERE (a /= 0.0) a = 1.0/a ELSEWHERE a = HUGE(a) END WHERE Further: it is permitted to mask not only the WHERE statement of the WHERE construct, but also any ELSEWHERE statement that it contains; a WHERE construct may contain any number of masked ELSEWHERE statements but at most one ELSEWHERE statement without a mask, and that must be the final one; WHERE constructs may be nested within one another, just FORALL constructs; a WHERE assignment statement is permitted to be a defined assignment, provided that it is elemental; a WHERE construct may be named in the same way as other constructs. The FORALL statement and construct When a DO construct is executed, each successive iteration is performed in order and one after the otheran impediment to optimization on a parallel processor. FORALL(i = 1:n) a(i, i) = x(i) where the individual assignments may be carried out in any order, and even simultaneously. The FORALL may be considered to be an array assignment expressed with the help of indices. FORALL(i=1:n, j=1:n, y(i,j)/=0.) x(j,i) = 1.0/y(i,j) with masking condition. The FORALL construct allows several assignment statements to be executed in order. a(2:n-1,2:n-1) = a(2:n-1,1:n-2) + a(2:n-1,3:n) + a(1:n-2,2:n-1) + a(3:n,2:n-1) b(2:n-1,2:n-1) = a(2:n-1,2:n-1) is equivalent to the array assignments FORALL(i = 2:n-1, j = 2:n-1) a(i,j)