Table of Contents
if Statement
if(Boolean_expression) {
// Statements will execute if the Boolean expression is true
}
if-else Statement
if(Boolean_expression){
//Executes when the Boolean expression is true
} else{
//Executes when the Boolean expression is false
}
if-else-if-else Statement
if(Boolean_expression 1){
//Executes when the Boolean expression 1 is true
} else if(Boolean_expression 2){
//Executes when the Boolean expression 2 is true
} else if(Boolean_expression 3){
//Executes when the Boolean expression 3 is true
} else {
//Executes when the none of the above condition is true.
}
Nested if-else Statement
if(Boolean_expression 1){
//Executes when the Boolean expression 1 is true
if(Boolean_expression 2){
//Executes when the Boolean expression 2 is true
}
}