Conditional if makes a substration of two variables, but from time to time, the result is "-0.00". how do I fix this?

I made a conditional interaction of two booleans that, when true, a substraction of two number variables occur:

if boolean1 == true and boolean 2 == true

numberVariable3 == numberVariable2 - numberVariable1

later I check numberVariable3 and if it equals to 0.00 then it should proceed to navigate to another artboard.

if numberVariable3 == 0

navigate to Artboard1

problem is, after random clicks of the booleans, the substraction stops working and it shows “-0.00” …thus because it does not equal to 0, it never takes me to artboard1. Why is it happening?

additionally to this, is not like i can correct it with another conditional statement. I tried putting a " if numberVariable3 == -0.00 but it does not accept the negative number. it takes it as an operator and thus, it thinks the statement is incomplete.

any ideas? I will appreciate a lot the help.

@Lucy13 You could try using <= 0 instead of ==0

That way your conditional will still function if the number goes into the negative.

sadly this didn’t work either…I don’t understand why though…

but i did fix it by just relaying the conditional on the booleans equal to true, instead of the variable equaling to 0. it was a workaround.

1 Like