From: Sam Sungshik Kong Date: 2004-06-09T09:38:38+09:00 Subject: Re: How can I use the last returned value? Hi! Thanks for the reply. However, I cannot do it. Could you elaborate a little bit more? I use Windows XP. And I brought up 'irb' and tried the following: irb(main):001:0> irb.conf[:EVAL_HISTORY]=1000 irb#1(main):001:0> irb.conf[:SAVE_HISTORY]=100 irb#2(main):001:0> 3+3 => 6 irb#2(main):002:0> _ => nil irb#2(main):003:0> What's wrong? Thanks again. Sam wrote in message news:200406082253.i58MrAwl019111@sharui.nakada.niregi.kanuma.tochigi.jp... > 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 > >