Control statements are an essential part of programming languages and play a crucial role in determining the flow of execution in a program. If some problem we have to check many conditions to be checked in this scenario if and if else will not work. For this a new control statement is required in which is called as if else if control flow statement. In this the control flow starts with if condition and ends with else block. In between if , else one or more than one else if blocks will be present. Each else if block consists of one condition statement if the condition is ture then the purticular else if block will be executed else next subsequent else if block condtion will be checked. if none of the else if conditons are true then else block will be executed.
if (condition1) {
// code block to be executed if the condition is true
}
else if(condition2 ){
// code block to be executed
}
else if(condition3 ){
// code block to be executed
}
...
else{
//code
}