3 ms·
Like GOTO it makes the execution harder to reason about as you could easily miss it. It doesn't bother me personally but I can sort of see an argument for it.
by jayd16 8y ago
Like GOTO it makes the execution harder to reason about as you could easily miss it. It doesn't bother me personally but I can sort of see an argument for it.
- icholy 8y agoAvoiding early returns usually makes code harder to read. It's outdated advice which was meant for writing assembly.
- apta 8y agoIt's not outdated, it depends on context. Several modern languages, including Rust, Swift, Scala, Kotlin, and F# are built around having expressions as constructs (if, match, try, etc. are all expressions). Once you have that powerful feature it makes sense to write code in a certain way to make use of that, and it ends up being clearer a lot of the time.