if-else statements in C and C++

if-else

if(conditional)
{
  //code
}
else
{
  //code
}
Braces are only needed for multiline blocks of code. The else can be followed by an additional if statement, to form a chain of if-else ifs.

Related

Learn more about if and if-else statements