From: "David A. Black" Date: 2010-04-23T23:47:53+09:00 Subject: Re: What is wrong with this few lines of code Hi -- On Fri, 23 Apr 2010, Waldemar Dick wrote: > Hi, > > Am 23.04.2010 14:49, schrieb Damjan Rems: >> >> ar = Array.new( 2,[]) >> %w(a b).each do |e| >> ar[0]<< e >> ar[1]<< e >> end >> ar.each do |e| >> e.each {|line| p line} >> end >> >> Returns >> "a" >> "a" >> "b" >> "b" >> "a" >> "a" >> "b" >> "b" >> >> I would expect: >> "a" >> "b" >> "a" >> "b" > > works as expected with ruby 1.9.1p376 (2009-12-07 revision 26041) > [i386-cygwin]. Are you saying that you're getting the second result from exactly the same code? (It should give the first result.) David -- David A. Black, Senior Developer, Cyrus Innovation Inc. THE Ruby training with Black/Brown/McAnally COMPLEAT Coming to Chicago area, June 18-19, 2010! RUBYIST http://www.compleatrubyist.com