ABSTRACT

The variables and constants we have used so far have all been scalars, single values. Many engineering and scientific calculations also involve vectors and matrices, which are rectangular arrays of numbers. For representing vectors and matrices, Fortran provides a data structure called the array. An array is an ordered list of scalar elements, each of which can be referred to by its location in the array. Arrays follow the usual variable naming rules. The manipulation of arrays typically requires looping to perform the same operation on

a sequence of elements. In earlier chapters we saw several examples of looping, and in all of them the repetition was controlled by initializing a loop counter, incrementing and testing its value, and transferring control back to the top of the loop until no more iterations remain to be done. A free loop of that kind is necessary in a few circumstances, but Fortran provides another construct called the DO loop that is simpler and easier to use most of the time.