views:

37

answers:

1

Hi Inside rails console you can get the result of the previous operation with _ Is there any way to do such a thing inside ruby program?

+1  A: 

everything in Ruby is an object, so think about it, if any returned object is not assigned a reference then it will be marked for garbage collection, so no there is no way other than to assign a returned object to a variable!

Rajinder Yadav