previous | contents | next

example, Chapin, 1971). However, we need only a few basic symbols. A rectangle specifies one or more actions, with the expression in the box describing the results of the actions in terms of the data on which they depend. A diamond specifies that a decision is to be made among one or more alternatives, depending on the value of the computation stated- in the box (we use the term box indifferently for rectangles and diamonds). The lines show the control flow, so that if one takes the action at a box then one follows the arrow leading out of the box to determine what action to take next. Several control lines lead out from a diamond, corresponding t6 the different decisions that can be made, and they are labeled accordingly. Several control lines may impinge on a single box or a single line since there is no reason why one should not arrive at an action (or decision) from many separate places.

The important thing to realize about flowcharts (assuming you do not already know all. about them from programming) is that they express a single sequential scheme of computation, in which only one thing happens at a time (i.e., only a single box is active at a time) and where there is no memory at all of what particular sequence of activities in the past lead to the current state. One can follow the method shown in a flowchart by putting a button or similar token down at the active place (starting at the place marked entry or start) and looking only at the box containing the button and the lines that emanate from it.

 

Fig. 9. Flowchart to sum integers from 1 to N.


The flowchart only expresses the flow of control. The actions taken in the rectangles make changes in the data of the problem. (No changes in data ever occur in a diamond.) It is assumed that the current values of these variables are used in each box. Thus, values of the variables can be set in some rectangle, and then the flow of control made dependent on them via the expression in a diamond somewhere else. In Figure 9 this occurs when the variable i is finally increased until its value is N+1.

The language we use inside the boxes of a flowchart is standard algebra, with

 

26

previous | contents | next