Contents

Section 5.1 Simple Statements

Section 5.2 Statement Scope

Section 5.3 Conditional Statements

Section 5.4 Iterative Statements

Section 5.5 Jump Statements

Section 5.6 try Blocks and Exception Handling

Chapter Summary

Defined Terms

Like most languages, C++ provides statements for conditional execution, loops that repeatedly execute the same body of code, and jump statements that interrupt the flow of control. This chapter looks in detail at the statements supported by C++.

Statements are executed sequentially. Except for the simplest programs, sequential execution is inadequate. Therefore, C++ also defines a set of flow-of-control statements that allow more complicated execution paths.

Get C++ Primer, Fifth Edition 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.