[erlang-questions] head mismatch
Tue Feb 10 09:06:40 CET 2015
On Tue, Feb 10, 2015 at 12:01 AM, Roelof Wobben <r.wobben@REDACTED> wrote:
> Am I not alllowed to do this
> sum(x) ->
> x ;
> sum(x,y) ->
> x + y.
> or is there something else missing ?
That's correct. Those are two different functions, so a period rather than
semicolon should be used. In Erlang, functions in a module are identified
by their name and their arity (the number of arguments they take). The
first function would be sum/1 and the second is sum/2.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions