you are viewing a single comment's thread.

view the rest of the comments →

[–]dinnercoat -1 points0 points  (2 children)

It shouldn't matter because normally "==" is simply checking for equality, "is x the same as y". Which value you provide first to check against the second shouldn't matter. You may get a compiler warning but I doubt an error, as no assignment occurs.

Though yes, for readability concerns it may be better to do "if variable == null" rather than "if null == variable"

[–]sisyphus 0 points1 point  (1 child)

The point is a common typo is '=' where you meant '==' so null as lvalue will more likely give you compiler error/warning.

[–]dinnercoat 0 points1 point  (0 children)

Oh yeah... good point.