The Simple if Statement
Learn how C++ uses the simple if conditional statement.
We'll cover the following...
We'll cover the following...
In programming, we often come across points where we have to make a decision based on certain input or output of a statement. In C++, to do this, we use some statements called conditional statements. We’ll start with the most basic conditional statement, the if statement.
if() statement
The if statement takes one argument of type bool or an expression that returns a bool value. Upon execution of the if statement, the compiler moves to the if enclosed bracket if and only if the condition inside the if statement is true. Here, take a look at the flow diagram of the working conditional statement.