0

Elixir values are immutable but i can assign two values to same variable. How immutable variable works in Elixir? if x is 5 and it is immutable how can i assign again 7 value? Shouldn't it throw an error? Iex example

  • 1
    Elixir has the pin operator (^) which it uses to make variables immutable. if you use the pin operator, if you pin x to 5, you cannot assign it to 7 again. – Linda Kadz Mar 22 '22 at 19:41
  • it is better explanation now. ^ is necessary for immutable variables. – Yusuf Yalcin Mar 25 '22 at 18:56

0 Answers0