This summer I’ve decided to learn ERLANG, so I’ll publish some posts about this argument.
First of all, I had to install Erlang. On my debian virtual machine, the installation of erlang is a one step operation.
$ sudo apt-get install erlang
using your favourite text editor type the following program and save it as hello.erl
run the erl shell typing the command
The above command will launch the erlang shell. Inside the shell compile the hello world program issueing the command:
then run the compiled hello world program typing the following command into the erl shell:
Note that each command must end with a dot.
To quit the erlang shell type CTRL-C and then q + enter.
Some info about the hello.erl source code:
Modules are a bunch of functions grouped in a single file, under a single name. Module is always the first attribute of a source file.
Exported functions represent a module’s interface.
exportis used to define what functions of a module can be called by the outside world. It takes a list of functions with their respective arity. The arity of a function is an integer representing how many arguments can be passed to the function.
Last, there is the implementation of the hello_world function.