[erlang-questions] Re: Concept of Side-effect
Fri Sep 18 04:18:29 CEST 2009
Kaiduan Xie wrote:
> Thanks a lot for the great examples. But I can not understand the following one,
> add(X,Y) ->
> add_effects(X,Y) ->
> What side-effect add_effects generates? Why we say io:format()
> generates side-effect?
The side-effect is that there is something printed to the console (or
stdout). If there were another function (say 'print_screen') that could
look at the screen, it is possible/likely a call to the add_effects
function would change the output of the function.
More information about the erlang-questions