Compound when statement

This works fine, with one little issue…The second possible acceptable correct answer gives the message without having to submit. I tried adding " ans9.submitted and" after the ‘or’, but that created the wrong answer message for the first correct answer. Its a pretty minor thing, but my curiosity is getting the best of me.

content: “{message} {feedback}”

message = “When the second equation is solved for y, what’s the new equation?”

feedback = when ans9.submitted and ans9.latex=“y=1-3x” or ans9.latex=“y=-3x+1”
“\n\n\n✅ Way to go ! !”
when ans9.submitted "\n\n\n❌Wrong answer. Please try again. Remember Get y
alone on the left!! \n\n "
otherwise “”

You missed otherwise before second when.
It should look:

content: message

message = "When the second equation is solved for y, what’s the new equation?${feedback}"

feedback = when ans9.submitted and ans9.latex="y=1-3x" or ans9.latex="y=-3x+1"
"\n\n\n✅ Way to go ! !" otherwise 
when ans9.submitted "\n\n\n❌Wrong answer. Please try again. Remember Get y
alone on the left!! \n\n "
otherwise ""```
btw, use slope and intercept function to avoid latex confusion. If there is an extra space in latex it cries and returns error.

@Mirko_Danilovic only the final otherwise is necessary for when-otherwise (i.e. when when when when … otherwise). It’s not like other coding languages that use "if and “else if”.

@rbrigida You may need to add parentheses:

feedback = when ans9.submitted and (ans9.latex=“y=1-3x” or ans9.latex=“y=-3x+1”)...

@Daniel_Grubbs Thanks. It makes it easier to code.
Then only thing that is missing in code is the $ sign infront of the feedback in content string.

They may not have actually missed the $. It just disappears in the forum if you don’t use the triple backticks to display in the box.

Yes, the $ did disappear…and i did not know you could use parentheses …makes perfect sense now!! Opens up lots of other possibilities…

The latex check is good enough for now.

Thanks to both of you!