next up previous

1 Overview of Fortran 90     continued...

Control Structures
Missing from Fortran 77 is a complete set of modern control structures (it has only IF - THEN - ELSE - END IF); this is remedied in Fortran 90 with the addition of DO - END DO and SELECT CASE - END SELECT control structures. The CASE construct, which has the form:
SELECT   CASE   (expression)
         CASE   (value-list)
         ...
         CASE   (value-list)
         ...  
         ...  
END SELECT
provides ``parallel" selection control. It offers no increase in semantic power over the IF (``sequential") selection control, but in situations where it fits the problem CASE offers computational advantages over IF because only one expression is evaluated.

The new DO construct is likely to be extremely useful in computational science applications. The reason is that, in order to realize the computational benefits of data parallelism, a great many indexed do loops will be replaced by array operations. The emphasis in the use of loops will therefore shift from processing arrays to indefinite repetition operations such as ``read-test-process" and ``while" repetition. The two new forms of DO construct added in Fortran 90 therefore are:

 
DO                                 DO WHILE (logical-expr) 
     ...                                   ...  
     IF (logical-expr) EXIT        END DO
     ...  
END DO
Indexed loops may also be terminated with END DO, in which case the loop label is not needed. (Loop labels are permitted, however, in all three forms of DO construct.)