Nested If Else Statement - C Tutorial

Nested If Else Statement

Nested if else statment is same like if else statement, where new block of if else statement is defined in existing if or else block statment.

Used when user want to check more than one conditions at a time.

Syntax of nested if else statement

if(boolean_expressionA)
{
     if(boolean_expressionB)
     {
              //executes when the boolean expressionA and expressionB is true
     }
     else
     {
             //executes when the boolean expressionA is true but expressionB is false
     }
}
else
{
         //executes when the boolean expressionA is false
}