bounds(1) to bounds(2) REAL integrate INTERFACE FUNCTION f(x) REAL f, x END FUNCTION f END INTERFACE REAL, DIMENSION(2), INTENT(IN) :: bounds : END FUNCTION integrate and to integrate f(x, y) over a rectangle: FUNCTION fy(y) USE func ! module func contains function f REAL fy, y yval = y fy = integrate(f, xbounds) END Direct recursion is when a procedure calls itself, as in RECURSIVE FUNCTION factorial(n) RESULT(res) INTEGER res, n IF(n.EQ.0) THEN res = 1 ELSE res = n*factorial(n-1) END IF END Here, we note the RESULT clause and termination test. Pure procedures This is a feature for parallel computing. In the FORALL statement and construct, any side effects in a function can impede optimization on a parallel processor the order of execution of the assignments could affect the results. To control this situation, we add the PURE keyword to the SUBROUTINE or FUNCTION statementan assertion that the procedure (expressed simply): alters no global variable, performs no I/O, has no saved variables (variables with the SAVE attribute that retains values between invocations), and for functions, does not alter any of its arguments. A compiler can check that this is the case, as in PURE FUNCTION calculate (x) All the intrinsic functions are pure. Array handling Array handling is included in Fortran for two main reasons: the notational convenience it provides, bringing the code closer to the underlying mathematical form; for the additional optimization opportunities it gives compilers (although there are plenty of opportunities for degrading optimization too!). At the same time, major extensions of the functionality in this area have been added. We have already met whole arrays above #Arrays 1 and here #Arrays 2 - now we develop the theme. Zero-sized arrays A zero-sized array is handled by Fortran as a legitimate object, without special coding by the programmer. Thus, in DO i = 1,n x(i) = b(i) / a(i, i) b(i+1:n) = b(i+1:n) - a(i+1:n, i) * x(i) END DO no special code is required for the final iteration where i = n. We note that a zero-sized array is regarded as being defined; however, an array of shape (0,2) is not conformable with one of shape (0,3), whereas x(1:0) = 3 is a valid 'do nothing' statement. Assumed-shape arrays These are an extension and replacement for assumed-size arrays. Given an actual argument like: REAL, DIMENSION(0:10, 0:20) :: a : CALL sub(a) the corresponding dummy argument specification