4 ms·
yeah this is kind of horrible once you get to high levels of nesting. in an imperative language you can return early in the error paths and your function will s
by benmmurphy 7y ago
yeah this is kind of horrible once you get to high levels of nesting. in an imperative language you can return early in the error paths and your function will still be understandable. this doesn't work with a single return. you can easily have 6 guard statements in an imperative language and your function will be comprehensible try doing 6 levels of nesting in elixir and it will be a complete mess.
- andrenth 7y agoMaybe the “OK” library [1] could be useful for you. I would also welcome a better built-in idiom for early returns. [1] https://hexdocs.pm/ok/readme.html https://hexdocs.pm/ok/readme.html