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 ) statement else statement
switch ( expression ) statement