Reputation: 5044
I'm a newbie in Erlang so stay with me.
I've got this function in erlang that I'm trying to compile, through the file animal.erl
.
module(animal).
help_moi(Animal) ->
Talk = if Animal == cat -> "miaou";
Animal == beef -> "meuuuh";
Animal == dog -> "Wouf";
Animal == tree -> "treee!";
true -> "ezfezfezf,"
end, %blablabla%
{Animal ,"dit", ++ Talk ++ "!" }. %oh là là là%
I'm then compiling it with erl
c(animal).
And these the errors , I'm having
1> c(animal).
animal.erl:1: syntax error before: '.'
animal.erl:9: syntax error before: '++'
animal.erl:9: no module definition
error
I tried to look on google but not much documentations on it.
Any ideas?
Upvotes: 1
Views: 249
Reputation: 41528
The module directive starts with a -
character:
-module(animal).
And you have an extra comma between "dit"
and ++ Talk
.
After fixing those two things, I get a warning, not an error:
animal.erl:2: Warning: function help_moi/1 is unused
You probably want to export the function, so you can call it from outside the module:
-export([help_moi/1]).
Upvotes: 6