11 ms·
I agree most of the time, but it can make sense in certain contexts. One common example is comparison methods: if (x1 < y1) return true; if (x2 < y2) ret
by Twisol 4y ago
I agree most of the time, but it can make sense in certain contexts. One common example is comparison methods:
if (x1 < y1) return true;
if (x2 < y2) return true;
if (x3 < y3) return true;
return false;
I wouldn't want to replace the last two lines with `return (x3 < y3)`, even though that's functionally the same thing.
In this contrived example, we could just return a single compound condition, but hopefully it's clear that there are cases where doing so would make more of a mess, too.