From: Daniel Waite Date: 2007-11-08T05:07:13+09:00 Subject: Re: how to delete array Surjit Nameirakpam wrote: > 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. > > So i need to dynamically pass the index value and this should delete the > values pertaining to the index You can't delete by index if you don't have an index, so I assume your program will have the index in some form or another. Perhaps in a variable? a.delete(some_index) # where some_index contains an integer If you post more of your program we'll be better able to help you. -- Posted via http://www.ruby-forum.com/.