From: Paul Lutus Date: 2006-08-20T19:05:10+09:00 Subject: Re: Remove from an array Hal Fulton wrote: > Paul Lutus wrote: >> Nicolas Benady wrote: >> >> >>>Hello, >>>I have an array, let's name it items[] >>>I want to remove an object in a elegant way >>>items.remove(3) does not work >>>How should I do ? >>>Thanks >>> >> >> >> items.delete_at(3) >> >> Just like in the documentation. >> > > Did he want to remove the element at index 3, > or remove instances of 3? I suppose I should have asked that before replying. :) If your theory is correct, then: items.delete_if { |x| x == 3 } Removes all items matching "3". -- Paul Lutus http://www.arachnoid.com