Example: if Condition
Use if conditional statement if you want to execute something based on some condition.
Example: 1
If 1 is greater than 0 then the condition is true and out will be True if the condition is false then the output will be false.
Example: 2
Declare two variables var mySal and var yoursal then display whose salary is greater.
Example: else Condition
Use the else statement when you want to execute the code every time the if condition evaluates to false.
Example: 1
Example: else-if condition
Use the “else if” condition when you want to apply the second level condition after the if statement.