3 ms·
For a single condition it doesn't matter much either way for readability. But once you have a number of conditions the if/else style becomes unwieldy. I put a
by wvenable 6y ago
For a single condition it doesn't matter much either way for readability. But once you have a number of conditions the if/else style becomes unwieldy.
I put all my early returns at the top as these are the preconditions for the rest of the code; I don't think that's hard to understand.