Exercism v3 launches on Sept 1st 2021. Learn more! ๐Ÿš€๐Ÿš€๐Ÿš€
Avatar of sylwester

sylwester's solution

to Hello World in the Erlang Track

Published at May 17 2021 · 0 comments
Test suite

The classical introductory exercise. Just say "Hello, World!".

"Hello, World!" is the traditional first program for beginning programming in a new language or environment.

The objectives are simple:

  • Write a function that returns the string "Hello, World!".
  • Run the test suite and make sure that it succeeds.
  • Submit your solution and check it at the website.

If everything goes well, you will be ready to fetch your first real exercise.

Running tests

In order to run the tests, issue the following command from the exercise directory:

For running the tests provided, rebar3 is used as it is the official build and dependency management tool for erlang now. Please refer to the tracks installation instructions on how to do that.

In order to run the tests, you can issue the following command from the exercise directory.

$ rebar3 eunit


For detailed information about the Erlang track, please refer to the help page on the Exercism site. This covers the basic information on setting up the development environment expected by the exercises.


This is an exercise to introduce users to using Exercism http://en.wikipedia.org/wiki/%22Hello,_world!%22_program

Submitting Incomplete Solutions

It's possible to submit an incomplete solution so you can see how others have completed the exercise.


%% Generated with 'testgen v0.2.0'
%% Revision 1 of the exercises generator was used
%% https://github.com/exercism/problem-specifications/raw/42dd0cea20498fd544b152c4e2c0a419bb7e266a/exercises/hello-world/canonical-data.json
%% This file is automatically generated from the exercises canonical data.



-define(assertStringEqual(Expect, Expr),
        begin ((fun () ->
            __X = (Expect),
            __Y = (Expr),
            case string:equal(__X, __Y) of
                true -> ok;
                false -> erlang:error({assertStringEqual,
                    [{module, ?MODULE},
                     {line, ?LINE},
                     {expression, (??Expr)},
                     {expected, unicode:characters_to_list(__X)},
                     {value, unicode:characters_to_list(__Y)}]})

-define(_assertStringEqual(Expect, Expr), ?_test(?assertStringEqual(Expect, Expr))).

'1_say_hi_test_'() ->
    {"Say Hi!",
     ?_assertStringEqual("Hello, World!",


hello() -> "Hello, World!".

Community comments

Find this solution interesting? Ask the author a question to learn more.

What can you learn from this solution?

A huge amount can be learned from reading other peopleโ€™s code. This is why we wanted to give exercism users the option of making their solutions public.

Here are some questions to help you reflect on this solution and learn the most from it.

  • What compromises have been made?
  • Are there new concepts here that you could read more about to improve your understanding?