I just stomped at a begin...end
in Erlang's documentation (here), but it doesn't give some examples of how it is useful.
Looking here in StackOverflow I found two cases where people would be using begin...end
, both in list comprehensions:
- https://mcmap.net/q/749098/-erlang-list-comprehension
- https://mcmap.net/q/685565/-hidden-features-of-erlang-closed
But I wonder if there are more of such uses.
Can anyone provide another scenario in which a begin...end
is useful in Erlang?
Thanks
T = {1,2,begin 1+2 end}.
will evaluteT={1,2,3}
– Spiny