Well. Things beeing immutable, means basically that you can’t change them after creation.
So, whenever you wan’t to transform data, you have to assign the new blob of data or pass it further down the chain using a pipe (|>). If you do not do that, the last result will be “forgotten” immediately as in your first version.
Now elixir does allow to “rebind” names, so by doing var = 1; var = var + 1 it sometimes seems that my above statement isn’t true. But what really happens is, that this compiles to some code similar to this: var1 = 1; var2 = var1 + 1.