Hidden Ruby Syntax That Will Impress Your Cat
Disclaimer; Your cat probably will NOT be impressed.

However, your coding co-workers looking over your shoulder while you bang out some code might if you use the lesser known underscore method! The underscore method simply gives you the return value of the last evaluation made in the console.
The underscore method simply gives you the return value of the last evaluation made in the console.
I find this especially useful in the event I forget to assign the output of a block of code or when I perform a query via Rails that I’d rather not run again.
An Example

Above is a screenshot detailing an example use case. In that example, I evaluated a block of code with a 5-second pause (to simulate a slow operation) without assigning it to the variable animal. Nothing to worry about, you can just use the underscore to avoid having to execute that code again!
Conclusion
The underscore is a useful method to use when you are working in a Ruby terminal. Even though using this may not impress a cat or your fellow coding co-workers it might save you a lot of time. It may not seem like a lot of time to just re-run code… but it does add up!
What other kinds of hidden Ruby tricks are there out? Please comment on this post if you know any and are in a charitable mood.
