2 ms·
I had a similar early experience. Amusingly, what broke me out of it was coming back to imperative languages after a good stint with Clojure. My initial instinc
by eyelidlessness 3y ago
I had a similar early experience. Amusingly, what broke me out of it was coming back to imperative languages after a good stint with Clojure. My initial instinct, coming back to an imperative language, was to try to return a single expression. You can do that, but it makes for rather unidiomatic code.
Hewing more towards the idiom while trying to force functions towards a single return resulted in… a lot of statements, producing a lot of intermediate state. And it all gets much harder to follow.
I’ve since embraced early edge cases and early returns, largely because it allows more idiomatic use of a functional style in an imperative context. And all of that makes the code a great deal easier to understand than it would be otherwise.