DEV Community

Sahil Gadimbayli
Sahil Gadimbayli

Posted on

Get last returned value in the console

It happens that when we are working on the console we need to make use of last return value. It is also annoying when we forget to assign it to a variable to make use of it and have to type/copy it all over again.

When this happens, we can conveniently use underscore _ to retrieve the last return value.

$ irb

['I am last returned array']
_
['I am last returned array']
Enter fullscreen mode Exit fullscreen mode

Top comments (0)