4 ms·
I like early returns as well, especially in short functions where there is not a lot of code between returns. In other words if I can see all returns in a funct
by smhenderson 8y ago
I like early returns as well, especially in short functions where there is not a lot of code between returns. In other words if I can see all returns in a function on one screen of text then I'm OK with it and I think it improves readability.
On the other hand if I have to scroll up and down a lot to see all return paths then that's a problem. But I generally find the problem is that the function is too long/does too much and should be broken down into smaller pieces.