Writing an equation of a line

I am trying to get students to write an equation of a line and after they submit their answer I want it to say “correct” or “try again”. I am struggling with the code.
This is what I have so far:

correct: Answer1.latex = “y=-2x+15”

content:
when Answer1.submitted and correct “Correct” otherwise “Try again”

Any help is greatly appriciated

While matching latex is not the most recommended method of checking, using backticks (to the left of the 1 key) instead of quotes will increase the likelihood of it working. Also, you can use “this” instead of a component name if you are in that component’s CL.

correct: this.latex=`y=-2x+15`

Thanks!
Any idea how to make it tell the student their answer is correct or not correct?

You can’t access a correct: sink, but you can use variables. Altering your original, I usually do something like this (I like all answer checking in the component where students give answers or a graph if numerous calculations are needed.):

In input CL:

check= this.latex = `y=-2x+15`
correct: check

In your note CL (with some common tricks for giving feedback in the same note as your question or directions):

feedback= when not(Answer1.submitted) ""
          when check "Correct"
          otherwise "Try again."
content:
"Your instructions here.

${feedback}"