O'Reilly logo

The C++ Programming Language, Fourth Edition by Bjarne Stroustrup

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

9. Statements

A programmer is a machine for turning caffeine into code.

– A programmer

Introduction

Statement Summary

Declarations as Statements

Selection Statements

if Statements; switch Statements; Declarations in Conditions

Iteration Statements

Range-for Statements; for Statements; while Statements; do Statements; Loop exit

goto Statements

Comments and Indentation

Advice

9.1. Introduction

C++ offers a conventional and flexible set of statements. Basically all that is either interesting or complicated is found in expressions and declarations. Note that a declaration is a statement and that an expression becomes a statement when you add a semicolon at its end.

Unlike an expression, a statement does not have a value. Instead, ...

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