3 ms·
Early returns provide a breeding ground for subtle bugs. I wonder if the research considered that aspect as well.
by munchler 3y ago
Early returns provide a breeding ground for subtle bugs. I wonder if the research considered that aspect as well.
- n0n0n4t0r 3y agoNot forcibly if you keep every function short: then their structure is simple and less hazardous to read without error
- taneq 3y agoI’ve heard this before, and I can see how some cases (returning from random points in deeply nested loops or something) could cause issues, but in my experience early returns at the start of a function for error handling make things far simpler and more explicit compared with other options.