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:
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
Macros, for example:
-define(M(A, B),
begin
C = foo(),
bar(A, B, C)
end).