QuickStart Erlang Programming Hello-World on Gnu/Linux

December 28, 2015 | By the+gnu+linux+evangelist.

How to Get Started

  1. 2. Installing Erlang

    How to Install Erlang on Linux Distros

    Erlang SetUp for Linux
  2. 3. Making Hello-World

    Create an Erlang Hello World Example
    Here for simplicity I’ll make use of the nano editor..

    mkdir ~/Documents/erlang

    To put stuff into order an erlang directory is created with the above command

    cd ~/Documents/erlang

    We change to the target directory

    nano helloworld.erl

    And Append this Erlang content:

    -module(helloworld).
    -export([start/0]).
    
    start() -> io:format("Hello world~n").
    

    Ctrl+x to Save & Exit from nano editor

  3. 4. Running Hello World

    Now to Executing the Erlang Hello World.

    chmod +x ~/Documents/erlang/helloworld.erl

    This to give Execution Permissions

    erl

    Then we start the Erlang Shell to Compile and Run the example

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

    To compile the Erlang helloworld Module

    2> helloworld:start().
    Hello world/nok
    

    To Run

    3> halt().
    

    To Stop the program
    In the end to Quit the Erlang shell hits Ctrl+c twice…

  4. 5. Getting Started Docs

    OnLine Erlang Tutorials and Documents

    Erlang Docs

Contents


QuickChic Theme • Powered by WordPress