logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

RE: the beginner: msg#00425

Subject: RE: the beginner
> From: wicaksono [mailto:wicak.noeg@xxxxxxxxxx]
> 
> 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.




<Prev in Thread] Current Thread [Next in Thread>