[erlang-questions] getting started with IO: question about syntax

David Clarke Stevens <>
Mon Oct 30 11:19:52 CET 2006

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: ").

    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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20061030/4afb1e68/attachment.html>

More information about the erlang-questions mailing list