An else if is a better option.
Below is a sample code for multiple if statements −
if(condition_A){
//perform some action
}
if(condition_B){
//perform some action
}Below is a sample code for else if statement −
if(condition_A){
//perform some action
}
else if(condition_B){
//perform some action
}When else if statements are used, if a condition is satisfied, the checking stops there and the operations associated with the condition are executed. This way, the operations and conditions get over quickly.