Comment

Comment by rdtsc

> Where does Elixir allow mutable variables?

Everywhere pretty much. Learn a bit more how it works. Here is a good resource:

http://elixir-lang.org/getting-started/introduction.html

Here is an example:

   iex(1)> x=1
   1

   iex(2)> x=2
   2
x was 1, then it was 2. It mutated.

To compare here is Erlang:

   1> X=1.
   1 
   
   2> X=2.
   ** exception error: no match of right hand side value 2

Just like in math, once X=1, it stays that. It doesn't get to mutate.
parent rdtsc 11 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton