Curly Brackets in Introducing Else If Statements

Hi, everyone!

I’ve got a question about Introducing Else If Statements challenge. I seems like can’t pass the test if I put a curly bracket after “else”, BUT if I remove it, I can pass the challenge. The example on the left side and on the hint page clearly showed that there should be a bracket after “else”. So which is correct?

Your code has a missing closing brace. The last closing brace that you see is matched with the very first opening brace.

That said, no braces after else (or most other block constructs) is valid syntax, but they tend to introduce bugs, so it’s better to include them.

1 Like

I see. Thank you for explaining. :slight_smile: :four_leaf_clover: