Objects of different types problem

Hi

I’m trying to create a slide that will mark the answer to an addition of fractions question as correct if its entered in its simplest form and obviously mark as incorrect otherwise.

BUT I also want to give some feedback if their answer is incorrect only because it was not simplified so would display the message “Simplify your fraction”

To do this I thought I would do a latex check initially , and then have another variable that I would give a value to dependant on the latex check being wrong but a numericValue check being correct.

However I’m getting a

“Objects of different types are never equal…” warning message.

This is my code:(the correct answer is being pulled from a QAtable.cellContent(16,2) on another slide

disableEvaluation:true


check16=when ans16.latex=QAtable.cellContent(16,2) 1 otherwise 0`

check17=when ans16.numericValue=QAtable.cellContent(16,2) and check16=0 1 otherwise 0

correct: check16=1

The funny things is something similar is working on another slide, the only difference being I have 2 allowed anwsers in the table

cellContent is always a latex, and .numericValue is always a number.

Remember, you can also use .cellNumericValue - so compare ans16.numericValue=QAtable.cellNumericValue(16,2)

Just as a point of interest, you can simplify boolean (true/false) checks to avoid having to set a 1 or 0… so

check16= ans16.latex=QAtable.cellContent(16,2)

correct: check16

works perfectly and is a bit more succinct.

1 Like