Team LiB   Previous Section   Next Section
else keyword Else part of if statement

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

    Team LiB   Previous Section   Next Section