I’m trying to skip over calculating some numbers when the result would be an attempt to insert NaN into the DB. My code is as follows:
unless @X = 0 || @Y = 0 || Z= 0 #Don't execute below code if any of the three values = 0
#Do some stuff with @X, @Y and @Z
end
I know that X,Y and Z are positive integers, as they should be, however this statement is not triggering the code block in the unless clause. Am I blatantly misusing the || operator?
You’re using
=the assignment operator. You want to be using==the equality operator. Your code should look like this: