The Elseif Statement
Use the if...elseif...else statement to specify a new condition to test, if the first condition is false.Syntax:
if (condition) {
code to be executed if condition is true;
} elseif (condition) {
code to be executed if condition is true;
} else {
code to be executed if condition is false;
}
code to be executed if condition is true;
} elseif (condition) {
code to be executed if condition is true;
} else {
code to be executed if condition is false;
}
You can add as many elseif statements as you want. Just note, that the elseif statement must begin with an if statement.
No comments:
Post a Comment