In Ruby you have some tricks in the console. I always use the _ to retrieve the last return value. In Elixir, you have the same approach with v function. Let’s see:

iex help for v function

iex help for v function

As you can see, the function v can get the last value because it’s using the default value -1 or you can use v(line_number) to get the value from a previous one.

Important: This post was original published by me in https://medium.com/@erichkist/elixir-tips-1-copy-last-result-in-iex-871f148d7f41 on November 09, 2017.