Re:Don't use the greater than sign in programming
by makecheck on Monday February 22, 2016 @09:13AM
(#11150864)
For the range case, languages like Python got it right because the statement "1 < x < 5" means exactly what it would seem to mean.
For other languages I’m not sure it matters for inequalities.
For equality though, I always use the form "if (constant == x)" as opposed to "if (x == constant)" because in C it guarantees that the compiler will trip over an accidental-assignment typo. That is, "if (constant = x)" is a compilation error but "if (x = constant)" might be missed.
For other languages I’m not sure it matters for inequalities.
For equality though, I always use the form "if (constant == x)" as opposed to "if (x == constant)" because in C it guarantees that the compiler will trip over an accidental-assignment typo. That is, "if (constant = x)" is a compilation error but "if (x = constant)" might be missed.