[erlang-questions] getting started with IO: question about syntax
Mon Oct 30 11:35:24 CET 2006
David Clarke Stevens wrote:
> I know this is a typical noob question, but I'm just getting
> into Erlang and can't seem to get it working correctly. I've
> written a simple factorial function that I want to display
> text with, but the compiler complains about syntax...any help
> would be appreciated!!
> main() ->
> io:format("The factorial of 5 is: ").
The line above should terminate with a comma, not a period.
> fac(X) ->
> if X == 1 ->
> else ->
> X * fac(X - 1)
> The compile error I'm getting is:
> 21> c(factorial).
> ./factorial.erl:6: syntax error before: '.'
> ./factorial.erl:8: Warning: function fac/1 is unused
More information about the erlang-questions