by Example

Hello world


To get started create a file named `hello_world.erl` then start the Erlang interpreter with `erl`.



To print to the console use the `io` module. The ~n adds a new line to our output.



Once the interpreter has started, compile your module  by invoking the function `c/1`.
-module(hello_world).
-compile(export_all).


hello() ->
    io:format("hello world~n").


$ ls
hello_world.erl

$ erl
Eshell (abort with ^G)

1> c(hello_world).
2> hello_world:hello().
hello world
ok
Next: Values →