The judgment of correct vs incorrect could probably be handled without code at all, just by having a column in your conditions file that gives the correct answer for that trial, e.g. a file that looks like this:
and in your keyboard component, select “Store correct” and put
$correct_answer in the “Correct answer” field. An advantage of using the keyboard component to do this is that the result is automatically stored in the data file for you.
Have you watched the Stroop task tutorial, which covers this sort of stuff?
Then to give conditional feedback, just put something like this in the “begin routine” tab of a code component of the next routine, by asking the keyboard component whether it recorded a judgment of correct or not:
feedback = 'Well done!!'
feedback = 'Rubbish!!🤦♂️'
and then put
$feedback in the text field of a text stimulus on that routine, set to update “every repeat”. make sure the code component is above the text component, so that the latter gets to refer to the latest value of the feedback variable.