On 14.04.2008 19:25, Karl von Laudermann wrote:
> On Apr 14, 12:16 pm, Vincent Angeloni <nospam7... / mac.com> wrote:
>> Ah, yes. I knew it was something simple.
>> I'll just sort countarray so that the highest index value is first, and
>> perhaps that will take care of the problem!
>> Thank you.
> 
> Another approach would be: instead of deleting each item, put nil at
> each specified array index. Then, after you're done iterating, delete
> all the nils using Array#compact!, like so:
> 
> sizeList = [0,1,2,3,4,5,6]

Btw, the conventional way in Ruby is to use "size_list" instead of 
CamelCase for method and variable names.

> countarray = [3,4,6]
> countarray.each {|x| sizeList[x] = nil}
> sizeList.compact!

Yet another alternative is to delete based on /criteria/ and not /position/.

In this case that could be

# note, the array in the block is not the original
# array but contains entries to be deleted - it's
# only accidentally the same because of the way that
# size_list is built.
size_list.delete_if {|x| [3,4,6].include? x}

Or any other criterium.

Kind regards

	robert