© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2024
G. Gonzalez-Morris, I. HortonBeginning Chttps://doi.org/10.1007/979-8-8688-0149-5_4

4. Loops

German Gonzalez-Morris1   and Ivor Horton2
Santiago, Chile

In this chapter, you’ll learn how you can repeat a block of statements until some condition is met. The programming mechanism for this is called a loop. The number of times that a loop is repeated can be controlled simply by a count—repeating the statement block a given number of times—or it can be more complex, repeating a block until some condition is met, such as the user entering "quit". The latter would enable you to program the calculator example in the previous chapter to ...

Get Beginning C: From Beginner to Pro now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.