From: Robert Dober Date: 2007-03-17T07:16:07+09:00 Subject: Re: Issues using array.delete within a loop of the same array On 3/16/07, Phrogz wrote: > On Mar 16, 4:00 pm, james.d.mast...@gmail.com wrote: > > On Mar 16, 2:01 pm, Timothy Hunter wrote: > > > > > Use #delete_if instead. > > > > Thanks - I tried that and it also did not work. Sorry for not posting > > this attempt in my original: > > > > irb(main):001:0> a = [1,2,3,4,5] > > => [1, 2, 3, 4, 5] > > irb(main):002:0> a.each {|e| a.delete_if {|e2| e2 == e}} > > => [2, 4] > > Kindly suggest that you RTFM by typing "ri Array#delete_if" into your > console. :) > > If that doesn't make it clear, try this: > > a.delete_if{ true } This is a nice alias for a.clear ;) Robert > > > > -- You see things; and you say Why? But I dream things that never were; and I say Why not? -- George Bernard Shaw