In some languages it's better to use it, eg. in Java you can go with:
mString != null && mString.equals("test")
or
"test".equals(mString)
They do the same, but the second one adds hidden `defensive programming` to prevent NPE in `equals`. Saves time AND code.
Intended usage of if(a=b) should be written as if((a=b)). Don't know what tool you use at work or at home, but most static code analysers will point you that. Try SonarQube at least.
Comments
In some languages it's better to use it, eg. in Java you can go with:
or They do the same, but the second one adds hidden `defensive programming` to prevent NPE in `equals`. Saves time AND code.Intended usage of if(a=b) should be written as if((a=b)). Don't know what tool you use at work or at home, but most static code analysers will point you that. Try SonarQube at least.