[stmt.select.general] (original) (raw)

8 Statements [stmt]

8.5 Selection statements [stmt.select]

8.5.1 General [stmt.select.general]

1

#

Selection statements choose one of several flows of control.

selection-statement:
if constexpr ( init-statement condition ) statement
if constexpr ( init-statement condition ) statement else statement
if ! consteval compound-statement
if ! consteval compound-statement else statement
switch ( init-statement condition ) statement

See [dcl.meaning] for the optional attribute-specifier-seq in a condition.

[Note 1:

An init-statement ends with a semicolon.

— _end note_]

2

#

[Note 2:

Each selection-statement and each substatement of a selection-statementhas a block scope ([basic.scope.block]).

— _end note_]