Underscore

In IRB, the result of the last command is stored in the _ variable, useful when you need to reuse the result.

0024-underscore_1.png

If that’s not enough, you can activate the history, which will be accessible via the __ variable. ⚠️ This is not an array! It functions as a Hash whose keys are the IRB execution lines.

0024-underscore_2.png

There are still a few bugs, but it can be very useful too.

0024-underscore_3.png

Link to Ruby documentation for IRB history.