Tutorials say that data in Elixir is immutable, yet x = 1 followed by x = 2 works and x is then 2. In the Erlang shell, X = 1. followed by X = 2. fails with a "no match of right hand side value" error. Meanwhile my attempt to sum a list with total = 0 and Enum.each(list, fn n -> total = total + n end) leaves total at 0.
What does immutability mean here, and how are these three observations consistent?




