[erlang-questions] Division by Zero

James Rosenblum jrosenblum@REDACTED
Thu Nov 15 15:07:45 CET 2012


Valentin's very perceptive comment aside, you could use one of the two error handling mechanisms as in:


case catch A/N of
{'EXIT', {badarith,_}} ->
    io:format("Some error statement or whatever!~n",[]);
Normal -> Normal
    end.

or

try A/N 
    catch
error:badarith ->
    io:format("some statement or whatever ~p/~p~n",[A,N]);
Normal -> Normal
    end.

I'm not positive, but it seems like you might not be aware of these error handling mechanisms 


________________________________
 From: Valentin Micic <valentin@REDACTED>
To: Lucky Khoza <mrkhoza@REDACTED> 
Cc: erlang-questions@REDACTED 
Sent: Thursday, November 15, 2012 8:47 AM
Subject: Re: [erlang-questions] Division by Zero
 
Did you consider not dividing  by zero?

V/

On 15 Nov 2012, at 3:42 PM, Lucky Khoza wrote:

> Hi Erlang Developers,
> 
> How do i resolve division by zero errors in Erlang.
> 
> Kindest Regards
> Lucky
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121115/dcf511d2/attachment.htm>


More information about the erlang-questions mailing list