From: Robert Dober Date: 2006-08-20T19:33:22+09:00 Subject: Re: Remove from an array ------=_Part_25421_29258161.1156070000118 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 8/20/06, Paul Lutus wrote: > > 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 =3D=3D 3 } items.delete 3 > Removes all items matching "3". as you said Cheers Robert -- > Paul Lutus > http://www.arachnoid.com > > --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_25421_29258161.1156070000118--