Chapter Summary

C++ provides a limited number of statements. Most of these affect the flow of control within a program:

while, for, and do while statements, which provide iterative execution.

if and switch, which provide conditional execution.

continue, which stops the current iteration of a loop.

break, which exits a loop or switch statement.

goto, which transfers control to a labeled statement.

try and catch, which define a try block enclosing a sequence of statements that might throw an exception. The catch clause(s) are intended to handle the exception(s) that the enclosed code might throw.

throw expression statements, which exit a block of code, transferring control to an associated catch clause.

return, which stops execution ...

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.