[erlang-questions] newbie needing help getting started

Zoltan Lajos Kis <>
Sat Oct 10 15:57:09 CEST 2009


Hi Juan,

You need to copy that piece of code into a file named "math1.erl".
Then in the erlang shell first you need to compile the code...

1> c(math1).
{ok,math1}

...to be able to use the funcion:

2> math1:factorial(3).
6

Zoltan.

PS: If the compile does not work, you need to go to the directory, where 
"math1.erl" is:

0> cd("C:/Zed/Erlang").
"C:/Zed/Erlang"
ok


Juan Backson wrote:
> Hi,
>
> I am following the tutorial trying to get started.  I am getting error with
> the following sample code in ERL command line.
>
> 10> -module(math1).
> ** exception error: undefined shell command module/1
> 11> -export([factorial/1]).
> ** exception error: bad argument in an arithmetic expression
>      in operator  '/'/2
>         called as factorial / 1
>
>
> Could someone help me out ?  What is wrong ?
>
> jb
>
>   



More information about the erlang-questions mailing list