How to install ?
if you are using linux just type
sudo apt-get install erlang
on the terminal then it will automatically installed in to your machine.
OR
you can visit www.erlang.org/download.html and download and install erlang.
First glance at Erlang
ok.. now we are done with installation so, let's move on to next step...
get the terminal and type erl on it.
you will see
1> kind of a thing...
first let's use it as a calculator :
to do that you only need to type a statement and after the statement put a dot (.) and press enter.
e.g :
1> 123 + 77.
200
2>
DO NOT forget that DOT..
Compiling a erlang code..
let's write a simple code to calculate factorial numbers and compile it.
write the below code in a text file and saved it as test.erl
- module (test).
- export([fac/1]).
fac(0) -> 1;
fac(N) -> N * fac(N-1);
ok now it is done let's compile and run it.
on the terminal write
c(test).
we use c to compile.
and to run..
test:fac(10).
That's it so, i think that may give you an basic idea of erlang i will write some articles about erlang once i have time..
so, enjoy,
Kesh....
No comments:
Post a Comment