Check out example codes for "else if". It will help you in understanding the concepts better.

Code Example 1

if (condition1) {
  //  block of code to be executed if condition1 is true
} else if (condition2) {
  //  block of code to be executed if the condition1 is false and condition2 is true
} else {
  //  block of code to be executed if the condition1 is false and condition2 is false
}

Code Example 2

a = 1
b = 2
if a < b:
  print("a is less than b") # This will run because 1 < 2
else:
  #This only runs if the condition for the if statement is not met
  print("a is greater than or equal to b")

Code Example 3

if (hour < 18) {

    greeting = "Good day";

 }
else {

    greeting = "Good evening";

 }

Code Example 4

if (condition) {

  //  block of code to be executed if the condition is true

 }

Code Example 5

if (hour < 18) {

    greeting = "Good day";

 }

Code Example 6

if ( x > 10 )
{
cout << "x is greater than 10";
}
else
{
cout << "x is less than 10";
}

Learn ReactJs, React Native from akashmittal.com