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

Roelof Wobben r.wobben@REDACTED
Tue Feb 10 20:35:31 CET 2015


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




More information about the erlang-questions mailing list