|
| <prev next> |
Re: the beginner: msg#00435lang.erlang.general
wicaksono writes: > my file math1.erl as Wiliam Dominic writen. > > -module(math1). > -export([factorial/1]). > factorial (0) ->1; > factorial (N) -> N * factorial (N-1). > > one that make me confused, the error point to line 8 but > it only has 4 line :( > > I have tried to compile with so many formats ( in space > format), but it still didn't work. I suspect the file you're compiling is not the one you've shown above. Perhaps you're starting the compiler in a different directory to where the file is. Here's what happens on my system: matthias >cat math1.erl -module(math1). -export([factorial/1]). factorial (0) ->1; factorial (N) -> N * factorial (N-1). matthias >erl Erlang (BEAM) emulator version 5.1.1 [source] Eshell V5.1.1 (abort with ^G) 1> c(math1). {ok,math1} 2> math1:factorial(100). 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000 i.e. it works exactly as intended. Matt |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: The Erlang way - dynamic upgrade of a server and UBF extensions: 00435, Miguel Barreiro Paz |
|---|---|
| Next by Date: | Re: The Erlang way - dynamic upgrade of a server and UBF extensions: 00435, Chris Pressey |
| Previous by Thread: | Re: the beginneri: 00435, wicaksono |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |