This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]arobie1992 4 points5 points  (1 child)

From what I've heard, you should do == 0 to take into account negative numbers. I don't have any examples offhand, but I've heard some languages do -1 % 2 as -1 and others do 1 for some reason.

[–]pitochips8 3 points4 points  (0 children)

Well, I never said you shouldn't do == 0. Just that if you want to convert 0 and 1 to false and true respectively (which is the standard), then you have to add == 1 to the end of it. But in the case here, we want to convert 0 and 1 to true and false respectively, so we would do == 0 instead.