Programming Languages Section

Erlang Programming Language

What is Erlang Programming Language
Post by Amina Delali, December 26th, 2022

Some Facts

Erlang is a functional and concurrent programming language, used to develop concurrent and distributed systems. The declarative is suitable for programming telecommunications systems as well as for industrial embedded real-time control problems. The language offers solutions for programming large concurrent real-time systems.

Erlang allows at the same time, writing applications for single computers as well as for a network of computers.

The Erlang programming language is associated with the term OTP, that signifies Open Telecom Platform. It is at the same time, a set of libraries, and design principles for Erlang programs. The libraries are the Erlang runtime system, and ready to use components. The design principles provide a way to structure the system based on a concept called application. A way to package a system component as library modules or as a supervision tree.

One of the components of Erlang runtime system (ERTS), is the emulator running on top of the host operating system, and it acts similarly as a virtual machine. It is called BEAM, and it is also the machine on which the Elixir programming language runs.



How to install it

  • on Windows:

    Go to the official download page, and download the Windows installer. Run it, and follow the instructions of the installation.

  • on ubuntu :

      There is a Pre-built binary package available for Ubuntu, so all you have to do is to run these commands:

      sudo apt update
      sudo apt install erlang

The Hello World Example

Create a file named hello.erl in a specific folder (in your user folder for example). In that file, write the following code:

    -module(hello).
    -export([hello_world/0]).

    hello_world() -io:fwrite("hello, world\n").

Open the erlang shell, change the current folder to where you saved your file using the cd command, with some modifications:

  • The the path will be between parentheses, and quoted.
  • Replace each "\" character with the "/" character.
  • Finish the command with the . symbol.
  • For example, I saved my file in : "c:\Users\AMINA", the command will be: cd("c:/users/AMINA").

Now, run the following command to compile your code:
c(hello).

To run your code, type this:
hello:hello_world().



Additional Information

For more information about the Erlang language and the corresponding code, you can check the following pages:

Something to say ?

If you want to add something about the language or about this post, please feel free to do it by commenting below 🙂 .