Syntax error on else


#1

I'm not sure what's wrong with my else syntax.


#2

you're missing a } to close the function also what does the 3 make after the semicolon?
And be careful with your sentences as the SCT only accepts matches so " test" is not "test"


#3

I'm still getting an error on my ELSE. That's what's been confusing me.


#4

You have to {} for your if condition therefore the } before else will be interpreted to close the function and now the else is alone without any if belonging to it. Which doesn't make much sense to have an exception without a rule in the first place. Sry didn't noticed that in the first run.


#5

you are missing a } I would put it on line 12 and a { on line 6 before return


#6

I removed the brackets surrounding the if statement but I'm still getting an unexpected token if. I even checked the hint which shows if/else syntax and my code doesn't seem to deviate from the formula so I'm not sure what's wrong.


#7

The {} after the function keyword are mandatory the problem was that your if lacked an opening } and your function lacked a closing }.