Immutability Drives Everything

Let’s learn about immutability and some other functional aspects of Elixir.

Immutability in Elixir

Functional programming means that the same inputs will give us the same outputs. Elixir binds variables exactly once.

How Elixir feigns mutability

When we say Elixir doesn’t allow mutable variables, we might be tempted to push back. Technically, that’s correct, but we should see the games the compiler is playing to maintain the illusion of mutability. Take a look at this example:

Executable

Get hands-on with 1200+ tech skills courses.