DEV Community

Discussion on: The Useful & Hidden '_' Command In IRB

Collapse
 
detunized profile image
Dmitry Yakimenko

It's not a Ruby method, it's an irb (Ruby interactive prompt or REPL) shortcut for the result of the last evaluated expression. _ doesn't have such a meaning in a regular Ruby program.

Collapse
 
edwinthinks profile image
Edwin Mak

Hey Dmitry. Yep you are absolutely right! The _ expression cannot be used in regular Ruby programs. I'll update the post to add a clarifying statement about this point. Thanks!