Skip to content
Hello, Erlang
step 1/5

Reading — step 1 of 5

Learn

~1 min readSyntax Basics

Erlang was designed in 1986 at Ericsson by Joe Armstrong, Robert Virding, and Mike Williams as a language for writing fault-tolerant telephone switches. Today it powers WhatsApp's messaging, RabbitMQ, and most of CouchDB. Elixir runs on the same VM (BEAM).

A minimal Judge0-runnable program needs a module + main function:

-module(main).
-export([main/1]).

main(_) ->
    io:format("Hello, Erlang!~n").
  • -module(main). declares the module name
  • -export([main/1]). exports the main function (arity 1)
  • main(_) ignores the argument with _
  • ~n is Erlang's newline format specifier
  • Statements end with . (period)
  • Expressions inside a function are separated by , (comma), and the LAST one has no separator before its .

No semicolons. Periods end definitions.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…