This statement is basically used to check certain conditions or sometimes we reqiure to execute certain statement when specified condition true.
Syntax:
if (condition) //code that will run if the condition is true
When specified condition failed, else statement will be executed.
Syntax:
if (condition) //code that will run if the condition is true else //code that will run if the condition is false
When there are situations when we need to test several conditions thenuse else if condition.
Syntax:
if (condition1) //code that will run if the condition1 is true else if(condition2) //code that will run if the condition2 is true else if(condition3) //code that will run if the condition3 is true else //code that will run if the all contitions fails