[erlang-questions] head mismatch

Bob Ippolito bob@REDACTED
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.

-bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150210/f0502d90/attachment.htm>


More information about the erlang-questions mailing list