5.5 Selection Statements

The C++ selection statements, if and switch, provide a means to conditionally execute sections of code.

Syntax

selection-statement:
if (expression)statement
if (expression)statementelsestatement
switch (expression)statement

The statement in the if, else, and switch statements cannot be a declaration.