Name
else keyword — Else part of if statement
Synopsis
statement := if ( condition ) statement else statement
The else
keyword introduces
the else part of an if
statement.
If the condition is false, the
else
statement is executed.
Example
template<typename T>
T abs(T x)
{
if (x < T( ))
return -x;else
return x;
}
See Also
if
, statement, Chapter 4
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.