the beginner

WILLIAMS Dominic D.WILLIAMS@REDACTED
Wed Apr 30 14:04:00 CEST 2003


> From: wicaksono [mailto:wicak.noeg@REDACTED]
> 
> hi all, i'am just starting this erlang. I try to make 
> first aplication using windows as my os. I create a file 
> at c>Program Files\erl5.2\math1.erl as user guide.
> but while I compile it always show
> 
> ./math1.erl:8: premature end
> ./math1.erl:8: no module definition
> error
> 
> what is that mean ?
> 

Hi,

What have you put in your math1.erl file?
Did you forget the full stop ('.') at the end of the program?

Here is the program from the tutorial:

-module(math1).
-export([factorial/1]).
factorial(0) -> 1;
factorial(N) -> N * factorial(N-1).

                                 ^^^
This compiles fine, but if you forget the full stop at the end, like this:

-module(math1).
-export([factorial/1]).
factorial(0) -> 1;
factorial(N) -> N * factorial(N-1)
                                 ^^^      
the compiler gives the "premature end" error.

Regards,

Dominic.




More information about the erlang-questions mailing list