DEV Community

Discussion on: Ditching the "else" Statement

Collapse
 
mkovace profile image
Michael Kovacevich

I have a CS degree and I was taught that as well...unfortunately most CS professors don't have much recent industry experience.

Returning early can be very dangerous if you aren't keeping your functions small. If your functions are more than 10-20 lines of code, I'd avoid multiple returns because you'll create a bug factory.

Collapse
 
jimstockwell profile image
Jim Stockwell

Yes, well said: when it’s dangerous and when it’s not.