) else if truthy (

The else if statement allows you to add more cases to an if statement without any passthrough like in a switch statement.

// Example of an else-if statement
// Assigns a letter grade based on a numerical grade
grade = 85

if grade >= 90 (
    say "You got an A."
) else if grade >= 80 (
    say "You got a B."
) else if grade >= 70 (
    say "You got a C."
) else (
    say "You need to improve your grade."
)

Last updated