[erlang-questions] Why doesn't Erlang has return statement?
Wed Dec 17 08:50:41 CET 2014
Note that once you're used to erlang or functional programming, there's usually little need for an explicit return statement.
However, if you do need it, you can emulate return a bit awkwardly with throw(X) and an appropriate enclosing try ... catch (or perhaps just catch) to capture the result.
On Tuesday, December 16, 2014 9:05 AM, aman mangal <mangalaman93@REDACTED> wrote:
I have seen similar questions before on the forum but I could never understand the reason behind it. Is it due to theoretical reasons such as return statement makes it hard to reason about the program or practical reasons that it is hard to implement it (this doesn't seem right but I cannot think of anything else)?
Moreover, is there a good alternate to avoid nested case statements? Making more functions just seems tedious. Using catch statement seems another good alternate but my intuition is that it is not good practice, is it?
Thank youAman Mangalwww.prism.gatech.edu/~amangal7
erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions