iex(1)> a = 10
10
iex(2)> b = 20
20
iex(3)> a + b
30
You can get a specific row passing the index of the row:
iex(4)> v(3)
30
You can also specify an index relative to the current row:
iex(5)> v(-1) # Retrieves value of row (5-1) -> 4
30
iex(6)> v(-5) # Retrieves value of row (5-4) -> 1
10
The value can be reused in other calculations:
iex(7)> v(2) * 4
80
If you specify a non-existing row, IEx
will raise an error:
iex(7)> v(100)
** (RuntimeError) v(100) is out of bounds
(iex) lib/iex/history.ex:121: IEx.History.nth/2
(iex) lib/iex/helpers.ex:357: IEx.Helpers.v/1