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

Code Example 1

#include<iostream>
using namespace std;

int main()
{
    int grade;

    cin >> grade;

    if( grade >= 60 )
        cout << "You Pass!" << endl;
    else
        cout << "You Fail..." << endl;

    return 0;
}

Code Example 2

#include<iostream>
using namespace std;

int main()
{
    int grade;

    cin >> grade;

    if( grade >= 60 )
    {
        cout << "You Pass!" << endl;
    }
    else
    {
        cout << "You Fail..." << endl;
    }

    return 0;
}

Code Example 3

if (condition) {
  // block of code to be executed if the 
  condition is true
}

Code Example 4

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

Code Example 5

if( a == 10 ) {
      cout << "Value of a is 10" << endl;
   } else if( a == 20 ) {
      // if else if condition is true
      cout << "Value of a is 20" << endl;
   }

Code Example 6

if bool then
	--code
else
	--code
end

Learn ReactJs, React Native from akashmittal.com