3 ms·
I probably wouldn't pick up this habit simply because 1) You shouldn't be able to make an assignment (by itself) in an if and not get a compiler error in most
by ianbishop 17y ago
I probably wouldn't pick up this habit simply because
1) You shouldn't be able to make an assignment (by itself) in an if and not get a compiler error in most modern languages.
2) It goes against the logical flow. You are checking if a variable is equivalent to a constant, not if the constant is equivalent to your variable. If your code is read by someone else who is unfamiliar with this practice then they may get confused by the illogical flow of everything.
- richardw 17y agoAbout 2): So does "string".equals(variable), which is also 'backwards' but safer.