View Source Welcome to Elixir!
Elixir is a dynamic, functional programming language created by José Valim. It is great for building scalable and maintainable applications. It puts the FUN into FUNctional programming! This guide will walk you through its basics in less than 30 minutes.
This guide was written by Peter Ullrich. Please submit any comments on GitHub. If you want to support me, please consider buying my courses (one and two) or my book 💜.
Install Elixir
Let's first install Elixir and Erlang. You can find instructions in the official installation guide.
However, a fast way to install the language on macOS
and linux
is to use the asdf version manager:
# Install the elixir and erlang plugins
asdf plugin add elixir
asdf plugin add erlang
# Now install erlang
asdf install erlang latest
asdf global erlang latest
# And Elixir
asdf install elixir latest
asdf global elixir latest
# You can check that Elixir is installed with:
elixir -v
Run the Code
If you want to run the following code yourself, there are three options:
- Recommended: Install Livebook (see the link for instructions) and simply click the
Run in Livebook
button above each file to open it in an interactive notebook. The files will open on your local computer. - Start an Elixir REPL with
iex
and copy and paste the code into the command line. - Copy and paste the code into an Elixir script file, like
script.exs
, and runmix run script.exs
.
Let's begin!
Tip
You can navigate through the pages with the
left
andright
arrow
Let's begin: Learn how to write 'Hello World'