Erlang basic syntax error -
i try learn erlang. i've installed runtime cannot working. following code:
x=3.
works, following doesn't
f(x)->x.
or
f() ->0.
or
f([])->[].
etc. produce "1: syntax error before: '->'" tried "word_count" tutorial: http://www.ybrikman.com/writing/2012/11/04/seven-languages-in-seven-weeks-erlang/ , same error.
what wrong here?
in repl have use fun(...) -> ... end
:
1> f = fun(x) -> x end. #fun<erl_eval.6.80484245> 2> f(42). 42
if have code in file use c
command:
1> c(word_count). {ok,word_count} 2> word_count:word_count([]). 0
Comments
Post a Comment