Chaining If Else Statements Madness

function testSize(num) {

  // Only change code below this line

if (num < 5) {

  return "Tiny"

  } else if (num < 10) {

  return "Small"

    } else if (num < 15) {

  return "Medium"

  } else if (num < 20) {

  return "Large"

  } else (num >= 20) {

  return "Huge"

  }

return "Change Me";

  // Only change code above this line

I tried this with and without the semi ; after each. also with each but excluding the last return. Its probably some dumb mistake I’m making. is there anyone that can help me figure out what?

Else statements do not have a condition after them. You can think of else as ‘if none of the other conditions were met, then do this’.

1 Like

Remove the condition here. Else statements do not take a condition.

1 Like

problem solved. ty ty

1 Like

In what way is it not working? Your code runs as I would expect it to, although the fact that there is a line that says return "Change Me" I’d be willing to bet that you didn’t follow the instructions carefully enough.