[erlang-questions] try/catch

Zoltan Lajos Kis kiszl@REDACTED
Tue Jun 29 17:48:54 CEST 2010


An example for begin-end is having multiple expressions in list 
comprehension:

[io:format("~p~n", [N]), N || N <- [1,2,3,4]].                  % syntax 
error
[begin io:format("~p~n", [N]), N end || N <- [1,2,3,4]].   % OK

Zoltan.

On 6/29/2010 3:36 PM, David Mercer wrote:
> On Monday, June 28, 2010, Wes James wrote:
>
>    
>> I also
>> need to remember that an expression is more than just a single line of
>> code but can be several lines separated by a "," in erlang.
>>      
> I was previously unaware of that, myself.  I knew it could be done with the
> "begin" and "end" keywords, but not without.  What, then, are the begin/end
> keywords for?
>
> Like Garrett, I usually use try...of to ensure I am catching errors only
> where I expect them.  I don't like to catch errors.  In fact, I usually use
> "try" for the "after" clause rather than the "catch"...
>
> Cheers,
>
> DBM
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>    



More information about the erlang-questions mailing list