O'Reilly logo

C Programming Absolute Beginner’s Guide, Third Edition by Dean Miller, Greg Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

16. Breaking in and out of Looped Code

In This Chapter

Taking a break

Continuing to work

This chapter doesn’t teach you how to use another kind of loop. Instead, this chapter extends the information you learned in the last two chapters. You have ways available to control the while loop in addition to a relational test, and you can change the way a for loop operates via means other than the counter variable.

The break and continue statements let you control loops for those special occasions when you want to quit a loop early or repeat a loop sooner than it would normally repeat.

Take a break

The break statement rarely, if ever, appears on a line by itself. Typically, break appears in the body of an if statement. The reason for this will ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required