whole array assignment of scalar value w = v + 1. ! whole array addition to scalar value w = 5/v + a(1:5, 5) ! array division, and addition to section flag = a==b ! whole array relational test and assignment c(1:8, 5:10) = a(2:9, 5:10) + b(1:8, 15:20) ! array section addition and assignment v(2:5) = v(1:4) ! overlapping section assignment The order of expression evaluation is not specified in order to allow for optimization on parallel and vector machines. Of course, any operators for arrays of derived type must be defined. Some real intrinsic functions that are useful for numeric computations are CEILING FLOOR MODULO (also integer) EXPONENT FRACTION NEAREST RRSPACING SPACING SCALE SET_EXPONENT These are array valued for array arguments (elemental), like all FORTRAN 77 functions (except LEN): INT REAL CMPLX AINT ANINT NINT ABS MOD SIGN DIM MAX MIN SQRT EXP LOG LOG10 SIN COS TAN ASIN ACOS ATAN ATAN2 SINH COSH TANH AIMAG CONJG LGE LGT LLE LLT ICHAR CHAR INDEX (the last seven are for characters). Control statements Branching and conditions The simple GO TO label exists, but is usually avoided in most cases, a more specific branching construct will accomplish the same logic with more clarity. The simple conditional test is the IF statement: IF (a > b) x = y A full-blown IF construct is illustrated by IF (i < 0) THEN IF (j < 0) THEN x = 0. ELSE z = 0. END IF ELSE IF (k < 0) THEN z = 1. ELSE x = 1. END IF CASE construct The CASE construct is a replacement for the computed GOTO, but is better structured and does not require the use of statement labels: SELECT CASE (number) ! number of type integer CASE (:-1) ! all values below 0 n_sign = -1 CASE (0) ! only 0 n_sign = 0 CASE (1:) ! all values above 0 n_sign = 1 END SELECT Each CASE selector list may contain a list and/or range of integers, character or logical constants, whose values may not overlap within or between selectors: CASE (1, 2, 7, 10:17, 23) A default is available: CASE DEFAULT There is only one evaluation, and only one match. DO construct A simplified but sufficient form of the DO construct is illustrated by outer: DO inner: DO i = j, k, l ! from j to k in steps of l