Elixir is a dynamic, functional language for building scalable and maintainable applications.
Elixir leverages the Erlang VM, known for running low-latency, distributed, and fault-tolerant systems. Elixir is successfully used in web development, embedded software, data ingestion, and multimedia processing, across a wide range of industries. Here is a peek:
- All Elixir code runs inside lightweight threads of execution (called processes) that are isolated and exchange information via messages
- Elixir runs on the Erlang VM giving developers complete access to Erlang's ecosystem, used by companies like Heroku, WhatsApp, Klarna and many more to build distributed, fault-tolerant applications
- To cope with failures, Elixir provides supervisors which describe how to restart parts of your system when things go awry, going back to a known initial state that is guaranteed to work
If you haven’t yet installed Elixir, visit installation page. Once you are done, you can run
elixir --versionto get the current Elixir version.
let’s start by running
iex means interactive elixir
iex(1)> 40 + 2 42 iex(2)> "hello" <> " world" "hello world" iex> String.length("The quick brown fox jumps over the lazy dog") 43
iex> 0b0110 6 iex> 0o644 420 iex> 0x1F 31
iex> :apple :apple iex> :orange :orange iex> :apple == :apple true iex> :apple == :orange false iex> true == :true true
iex> IO.puts("hello\nworld") hello world :ok
IO.puts/1function returns the atom :ok after printing.