How to Design While Loops
Marco T. Moraz\'an (Seton Hall University)

TL;DR
This paper introduces a step-by-step design recipe for teaching beginners how to create while loops, leveraging their prior knowledge of recursion and invariants to improve understanding and correctness.
Contribution
It presents a novel, structured approach to teaching while loop design, integrating concepts like invariants and mutation sequencing for novice programmers.
Findings
Enhanced student understanding of while loop design.
Improved correctness in student-implemented loops.
Structured recipe facilitates learning process.
Abstract
Beginning students find the syntactic construct known as a while loop difficult to master. The difficulties revolve around guaranteeing loop termination and around learning how to properly sequence mutations to solve a problem. In fact, both of these are intertwined and students need to be taught a model that helps them reason about how to design while loops. For students that have been introduced to how to design programs using structural recursion, generative recursion, accumulative recursion, and mutation, the task of teaching them how to design while loops is made easier. These students are familiar, for example, with state variables, termination arguments, and accumulator invariants. All of these are fundamental in the design of while loops. This articles presents a novel technique used at Seton Hall University to introduce beginners to the design of while loops. It presents a…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
