[erlang-questions] error on first run

Wes James <>
Fri Mar 26 04:07:26 CET 2010


2010/3/25 黃耀賢 (Yau-Hsien Huang) <>:
> No. Steps are:
> 1. Paste functions in a file, with the head written as
>    -module(mod_name).
>    -compile(export_all).
>   and name the file as 'mod_name.erl'.

<snip>

Thanks.  I was just doing that from the book.

I put this in a factorial file:

-module(factorial).
-export([factorial/1]).

factorial(0) -> 1;
factorial(N) ->
	N * factorial(N-1).


and then ran:

factorial(3).

and got an error then I remembered I had to do module_name:function(value)

this is an interesting language...

-wes


More information about the erlang-questions mailing list