Hi,
when building more involved activities I noticed it would be nice to be able to reference the correct expression (or its result) of a Math Input in other Components.
For example: I have a question where I like to give feedback based on the submitted answer. The feedback is shown via a Note.
So something like this in the Note script would be nice:
content: when input1.isCorrect() "Correct Answer!" otherwise "Try Again."
Otherwise I have to (re-)write the correctness expression in multiple scripts.
Or is there some best practice for this use case?
In the Note CL, put this:
content: when not(input1.submitted) "" otherwise when input1.script.correct = input1.latex "correct" otherwise "try again"
In the Math Input CL, add a variable I called correct (You can see correct=,which is not the same as the sink correct:), then you can use it for the correct sink, too:
correct=`y=3x+5`
correct: this.latex= correct
I used the latex content, but you could have used the numeric values.
I like to use check
for my variable, so there’s no confusion with the correct sink.
Also, (probably just an oversight, since you’ve done it other ways before), the first otherwise
isn’t necessary.