From: angico Date: 2008-08-24T17:25:34+09:00 Subject: Re: begin ... while ... ??? Em Qui, 2008-08-21 às 16:41 +0900, Kyung won Cheon escreveu: > --- test1.rb --- > > def test_begin_while(*l) > b = begin a = l.shift end while !l.empty? > end > > puts test_begin_while(1,2,3) > > # => nil > > > --- test2.rb --- > > def test_begin_while(*l) > b = begin a = l.shift end while !l.empty? > b > end > > puts test_begin_while(1,2,3) > > # => 3 > > ############### > # Help Me^^ > ############### If I did well understand, you just want to catch the values passed in as args to test_begin_while in an array. I'd do: irb(main):020:0> def test_begin_while(*l) irb(main):021:1> a = [] irb(main):022:1> b = begin a << l.shift end while !l.empty? irb(main):023:1> a irb(main):024:1> end => nil irb(main):025:0> test_begin_while 1, 2, 3 => [1, 2, 3] Hope this helps. Regards, -- angico ------ home page: www.angico.org Gnu/Linux, FLOSS, Espiritismo, e eu por mim mesmo 8^I ------ contatos: email: angico@angico.org skype: angico00 ------