Skip to content

Challenge Introducing Else Statements

SaintPeter edited this page · 2 revisions
Clone this wiki locally

Challenge: Introducing Else Statements

When a condition for an if statement is true, the block of code following it is executed. What about when that condition is false? Normally nothing would happen. With an else statement, an alternate block of code can be executed.

if (num > 10) {
  return "Bigger than 10";
} else {
  return "10 or Less";
}
Something went wrong with that request. Please try again.