re: Why using Yoda conditions you should probably not be VIEW POST

FULL DISCUSSION
 

I also have a personal beneficial side effect to Yoda:

if (1 == function(so many parameters)) {
...
}

seems so much easier to read than

if (function(so many parameters) == 1) {
...
}

because I immediately have the constant and the function name(and the return values of that function to an extent if code is documented and IDE actually does it's job).

I find it easier than scrolling through the whole list of parameters just to find out what I'm comparing to.

 

If the parameter list is so long that you need to scroll, you need to use some linebreaks. See my other post, dev.to/greg0ire/why-i-keep-pesteri...

code of conduct - report abuse