Blog Archives

Reversing equality test to avoid errors

Common mistake if(x=2) instead of if(x==2) Write the rvalue of the expression at the left side of the equality operator (==): if(2==x) In this case the compiler will warn you if you typed the assignment operator (=) by mistake.

Posted in Programming Tagged with: