Abstract
Until recently, Pascal was the first programming language taught to students. As more schools choose Ada or C++ as a first language, the debate on structured programming has been reopened ([Rob95]). We are no longer restricted to the while-statement: exit/break-statements can be used to exit a loop from the middle, and return from a procedure or function is allowed within a loop statement. Do these constructs violate the principle of structure programming? This article claims that more general loop constructs can be objectively justified, because they simplify the verification of programs. A program that is simple to verify is also easy to explain and understand.
- [CLR90] Thomas H. Cormen, Charles E. Leiserson, and Ronald L. Rivest. Introduction to Algorithms. MIT Press, Cambridge, MA, 1990.Google Scholar
Digital Library
- [Coo93] Doug Cooper. Oh! Pascal! (Third Edition). W.W. Norton, New York, 1993. Google Scholar
Digital Library
- [Knu74] Donald E. Knuth. Structured programming with go to statements. Computing Surveys, 6(4):261-301, December 1974. Google Scholar
Digital Library
- [Kof92] Eliot B. Koffman. Pascal: Problem Solving and Program Design (Fourth Edition). Addison-Wesley, Reading, MA, 1992.Google Scholar
- [Lon70] Ralph L. London. Certification of algorithm 245: Treesort 3. Communications of the ACM, 13(6):371-373, June 1970. Google Scholar
Digital Library
- [Man74] Zohar Manna. Mathematical Theory of Computation . McGraw-Hill, New York, 1974.Google Scholar
Digital Library
- [Rob95] Eric S. Roberts. Loop exits and structured programming: Reopening the debate. In Twenty-Sixth SIGCSE Technical Symposium, pages 268- 272, 1995. Google Scholar
Digital Library
- [Sed88] Robert Sedgewick. Algorithms (Second Edition). Addison-Wesley, Reading, MA, 1988.Google Scholar
- [Wir76] Niklaus Wirth. Algorithms + Data Structures = Programs. Prentice-Hall, Englewood Cliffs, NJ, 1976.Google Scholar
Index Terms
Structure exits, not loops
Recommendations
Multiple exits from a loop without the GOTO
For several years, there has been discussion about the use of the goto statement in programming languages [1, 2]. It has been pointed out that goto free programs tend to be easier to understand, allow better optimization by the compiler, and are better ...
A case for teaching multi-exit loops to beginning programmers
While programming using the WHILE and REPEAT constructs, as in Pascal, is well established and taught regularly, programming using a LOOP construct with multiple exits is not. I feel that this much more general construct is a more useful programming ...
Loop exits and structured programming: reopening the debate
Internal exits from loops represent a critically important control structure that should be taught in the introductory CS1 curriculum. Without access to those facilities, students are often incapable of solving simple programming problems that occur ...






Comments