How to write hello world in Erlang
This example will show you how to write a hello world program in Erlang.
- Create a new file called
hello.erl
. - Now add the following code and save it.
-module(hello).
-export([hello_world/0]).
hello_world() -> io:fwrite("hello, world\n").
- Compile the program by running the below command in your terminal (erlang shell).
1> c(hello_world).
2> hello_world:hello().
hello world
ok