From: nobu.nokada@... Date: 2004-06-09T07:53:15+09:00 Subject: Re: How can I use the last returned value? Hi, At Wed, 9 Jun 2004 02:03:37 +0900, Dennis Ranke wrote in [ruby-talk:102807]: > > In Python, I use '_'(underscore) for the last returned value. > >>>> print "Hello" > > "Hello" > >>>> x = _ > >>>> print x > > "Hello" > > > > What is the equivalent in Ruby? > > If you mean what's the equivalent in irb then my answer would be: > > IRB.CurrentContext.last_value > > But that's a bit cumbersome ;) EVAL_HISTORY enables _. $ grep HISTORY ~/.irbrc IRB.conf[:EVAL_HISTORY] = 1000 IRB.conf[:SAVE_HISTORY] = 100 $ irb irb(main):001:0> 2+2 => 4 irb(main):002:0> _ => 4 irb(main):003:0> -- Nobu Nakada