C++ Else If

C++Else If


C++ Else If :

 C++ Else If statement used to specify a new condition if the first condition is false. 

 The Syntax of else-if statement is as follows:

  if (condition1) {
  // if condition1 is true then block of code to be executed now.
else if (condition2) {
  // if condition1 is false then block of code to be executed now.

else {
  // if condition1 and condition2 is false then block of code to be executed now.
}
Example :

 Output :