Files
2025-10-25 03:02:53 +03:00

2.4 KiB

[stmt.select.general]

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 constexpropt ( init-statementopt condition ) statement
if constexpropt ( init-statementopt condition ) statement else statement
if !opt consteval compound-statement
if !opt consteval compound-statement else statement
switch ( init-statementopt 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-statement has a block scope ([basic.scope.block]).

— end note]