Skip to Main Content
The control computation for a loop in a program is that part of the program concerned with the initialization, incrementation, and testing of the variables that determine the flow of control into, through, and out of the loop. The elements of loop control computations are idenified and their role in structuring our understanding of loops is analyzed. It is argued, through examples drawn from a Pascal compiler, that the intelligibility of a loop is closely tied to the accessibility and intelligibility of the loop control computation. It is further argued, from an analysis of all the loops in this compiler, that most loop control computations fail in a few standard patterns, mostly concerned with the sequential processing of elements of data structures. In light of these results, common loop control statements are critiqued. It appears that better loop control structures than the while, repeat-until, and similar statement structures are possible and desirable, and some proposals for better structures are given.