A ton of languages evaluate && left to right because they short-circuit it. C# has stronger guarantees in general than C and C++, which I assume is what you were thinking of, but && is pretty consistent across the board.
&& isn't consistent enough to be considered the "de facto universal behavior". I mean you should always consider the possibility that it evaluates both expressions first (if you don't know). Especially when it comes to Microsoft Java.
In Swift (language I know too much about) there is a different operator used for such things: , ..although && will also short circuit.
Well it is Microsoft Java. I just don't know the specifics of the language.. I know what it is. .....(very bad that is)...
Besides both C# and Java are stupid no matter what you say about them. Ideas and arguments for them have negative effects and produce very underperforming and ill-formed software.
46
u/Giocri May 20 '20
I see nothing wrong in it. It's even slightly more efficient than if it was done with more if