[erlang-questions] exception error: an error occurred when evaluating an arithmetic expression

Rick Pettit rpettit@REDACTED
Tue Feb 10 20:37:37 CET 2015


Naturally you’ll need to rename the file accordingly as well :-)

-Rick

> On Feb 10, 2015, at 1:36 PM, Rick Pettit <rpettit@REDACTED> wrote:
> 
> You can try giving your module a legal name (i.e. try replacing the minus “-“ with an underscore “_”).
> 
> -Rick
> 
>> On Feb 10, 2015, at 1:35 PM, Roelof Wobben <r.wobben@REDACTED> wrote:
>> 
>> Hello,
>> 
>> I have this code  :
>> 
>> -module(side-effects).
>> 
>> -export([display/1]).
>> 
>> display(Number) when Number > 0 ->
>> display_acc(Number,[]).
>> 
>> display_acc(0,Acc) ->
>> io:format("Number:~p~n",Acc);
>> 
>> display_acc(Number, Acc) ->
>> display_acc(Number -1, [Number | Acc]).
>> 
>> but as soon as I compile it, I see this message :
>> 
>> ** exception error: an error occurred when evaluating an arithmetic expression 
>>    in operator  -/2
>>       called as side - effects
>> 
>> 
>> What does that error exactly mean and how can I solve the code so I can make it work ?
>> 
>> Roelof
>> 
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
> 




More information about the erlang-questions mailing list