From: Joel VanderWerf Date: 2004-06-09T02:56:49+09:00 Subject: Re: How can I use the last returned value? Dennis Ranke wrote: > To get easier access to the last value, I put the following into my irb.rc: > > def ans > IRB.CurrentContext.last_value > end Nice. I tried defining the same with the name _, but that fails because _ happens to be a local variable that's already defined in an irb session. Oh, well. irb(main):001:0> defined?(_) => "local-variable" irb(main):002:0> local_variables => ["_"] irb(main):003:0> def _ irb(main):004:1> IRB.CurrentContext.last_value irb(main):005:1> end => nil irb(main):006:0> 3+4 => 7 irb(main):007:0> _ => nil