DEV Community

Cover image for Learn Elixir the language behind Whatsapp,Telegram, Discord and Pinterest
mridul037
mridul037

Posted on

Learn Elixir the language behind Whatsapp,Telegram, Discord and Pinterest

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:

Performance feature's of elixir:

Scalability

  • All Elixir code runs inside lightweight threads of execution (called processes) that are isolated and exchange information via messages

Erlang compatible

  • 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

Fault-tolerance

  • 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 --version to get the current Elixir version.

let’s start by running iex means interactive elixir

some basic code
iex(1)> 40 + 2
42

iex(2)> "hello" <> " world"
"hello world"

iex> String.length("The quick brown fox jumps over the lazy dog")
43
Enter fullscreen mode Exit fullscreen mode
Support for binary, octal, and hexadecimal numbers comes built in:
iex> 0b0110
6
iex> 0o644
420
iex> 0x1F
31
Enter fullscreen mode Exit fullscreen mode
ATOMS
iex> :apple
:apple
iex> :orange
:orange
iex> :apple == :apple
true
iex> :apple == :orange
false
iex> true == :true
true
Enter fullscreen mode Exit fullscreen mode
You can print a string using the IO.puts/1 function from the IO module
iex> IO.puts("hello\nworld")
hello
world
:ok
Enter fullscreen mode Exit fullscreen mode

IO.puts/1 function returns the atom :ok after printing.

In next Article we will go more deep into Elixir Laguage.

Top comments (0)