MC feedback issue

This screen worked until recently, and now I get an error that says
“Syntax error: toplevel declarations must be variable or sink assignments”
The exclamation mark with the error shows up right next to my first “when” statement. When I remove the text I want it to return it moves to the second “when” statement. If I remove that return text too it moves to my last line as says "Unexpected token “$”

I’m so confused what changed that is making this no longer work. All I want is to have the kids know if they picked the right MC answer. HELP!

choice=choiceslide20

#These are the variables for the choice options.
A=choice.isSelected(1)
B=choice.isSelected(2)
C=choice.isSelected(3)
D=choice.isSelected(4)
correct=C

directions="A system of inequalities is shown. From the given points, select the point that is a solution to this system of inequalities:

y-1\le2x

x+y\ge7

content:
#THIS IS THE CORRECT ANSWER.
when choice.submitted and correct " Correct "

#THESE ARE THE INCORRECT POSSIBILITIES
when choice.submitted and not© " Try again "

#This displays the direction.
otherwise “${directions}”

Not sure what’s wrong.
I think I got it working here…

Could be a small typo with " ’ etc?
Hope this helps.

If you copy-pasted your code, then it looks like you didn’t close your quotes for the directions variable. Also, if you’re trying to display code in the forums, you can use triple backticks in lines above and below, and it will box it out like this (also won’t do some weird formatting like the copyright symbol that popped up):

A=choice.isSelected(1)
B=choice.isSelected(2)...

Also, nested when-otherwise can be useful:

content:
when choice.submitted
 (when correct "Correct"
  otherwise "Try Again")
otherwise "${directions}"
1 Like