if

suggest change

The keyword if must be followed by a parenthesized condition, which can be either an expression or a declaration.

If the condition is truthy, the sub-statement after the condition will be executed.

#include <iostream>

int main()
{
    int x = 1;
    if (x > 0) {
        std::cout << "x (" << x << ") is greater than zero\n";
    }
}
x (1) is greater than zero

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Flow control:
* if
* else
* case
* switch
* catch
* throw
* try
* goto
* return

Table Of Contents
8 Arrays
9 Flow control
11 Loops
39 Streams
51 Unions
56 Lambdas
60 SFINAE
62 RAII
67 Sorting
84 RTTI
87 Scopes
104 Profiling
107 Recursion
117 Iteration
125 Alignment
134 Semaphore
136 Debugging
139 Mutexes
142 decltype