Else If Statement

	if(condition1){
		//Statements-1...
	}
	else if(condition2){
		//Statements...
	}
	else if(condition3){
		//Statements...
	}
	
	...
	
	else{
		//Statements...
	}

This whole individual structure of If Else statement is known as "If Else Ladder".

First, condition1 is checked and if it's true, Statements-1 get executed and rest of the structure is skipped. If the condition1 is evaluated to false then the Statement-1 is skipped and controll jump over to the condition2 and check if the condition2 is true, if it is, then the statement-2 get executed and rest of the If-Else Ladder is skipped. If the second condition becomes false as well, then the control, jump over to the third condition and checks if it is true. If it is true, then the third if block get executed and rest of the structure is skipped. This process goes on until the any of the conditions becomes true. If all the condition becomes false then the control jump over to the else part and execute it.

You can write alternative structure to this in your own way using simple If statement or If-Else statement, but they will look bigger and loose readibility. This structure is simple, efficient and readable.

There's no limit on the number of else if part that might appear in the above structure. You can write as many as you want until you accompolish you are trying to do.

Another thing is that here else part is totally optional. If you don't have a else part and all the condition of If-Else Ladder becomes false, then nothing get executed. Make sense.

	if(condition1){
		//Statements-1...
	}
	else if(condition2){
		//Statements...
	}
	else if(condition3){
		//Statements...
	}
	...

Like before, you cannot have any statement in between each block of this structure. For example, the below example is wrong and certainly will give you error -

	if(condition1){
		//Statements-1...
	}
	else if(condition2){
		//Statements...
	}
	Statement;
	else if(condition3){
		//Statements...
	}

As you clearly understand, each else if block must immediately follow the previous if or else if block.