What is begin…end in Erlang used for?

后端 未结 4 726
你的背包
你的背包 2021-02-19 11:57

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 f

4条回答
  •  礼貌的吻别
    2021-02-19 12:47

    To evaluate a catch (always the same idea to have multiple expression reduced to one)

    Res = (catch
        begin
            C = foo(Bar),
            io:format("evaluation of C ok~n"),
            D = bar(A, B, C)
         end),
    

提交回复
热议问题