Check out example codes for "if elase in c++". 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
}

Learn ReactJs, React Native from akashmittal.com