From: Leslie Viljoen Date: 2007-11-08T05:19:04+09:00 Subject: Re: how to delete array ------=_Part_39173_28286398.1194466744659 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Nov 7, 2007 10:02 PM, Surjit Nameirakpam wrote: > Problem > > consider an array > > a = [1,4,6,7,9,8] > > I want to delete the array value w.r.t index > > e.g i want to delte 0,4,6 element in one go > > I can use the command > a.delete_at(0) > a.delete_at(4) > a.delete_at(6) > > But the problem is that i dont know how much element will be populated > in my array every time the program runs and the index value will also > change. If you really want to delete a few indexes you can build a new array: b = [] a.each_with_index {|e, i| b<< e if [0, 4, 6].include?(i)} a=b -- [we need your code-fu] : www.zadic.co.za ------=_Part_39173_28286398.1194466744659--