Now that you know how to use if statements, let's learn about the else clause. You can add an else clause after any if statement:
if (condition) {
// This code runs when condition is true
}
else {
// This code runs when condition is false
}This is how the computer executes an if/else statement:
Run the code sample in the editor and try different scores to see how the if/else statement chooses which message to display. Notice that you always get exactly one message, no matter what score you enter.
Output (Console)