Else if Ladder Statement

The if-else-if ladder statement executes one condition from multiple statements. The execution starts from top and checked for each if condition. The statement of if block will be executed which evaluates to be true. If none of the if condition evaluates to be true then the last else block is evaluated.

Syntax:

if(condition_expression_One)
{
statement 1;
}else if (condition_expression_Two)
{
statement 2;
}else if (condition_expression_Three)
{
statement 3;
}else
{
statement 4;
}