From: Robert Klemme Date: 2010-07-28T20:10:12+09:00 Subject: Re: multidimensional array insert syntax On 28.07.2010 12:56, Dave Castellano wrote: > Jesús Gabriel y Galán wrote: >> On Wed, Jul 28, 2010 at 4:02 AM, Dave Castellano >> wrote: >>> � ] >>> >>> >>> # Randomly insert correct answer. >>> �x = rand(4) >>> �answer_choices.insert???????? �correct_ans_1 >>> �answer_choices.insert???????? �correct_anno_1 >>> >>> >>> I want to insert correct_ans_1 into position [x,0] and correct_anno_1 >>> into position [x,0]. >> >> You nearly had it in that sentence: >> >> answer_choices[x][0] = correct_ans_1 >> answer_choices[x][1] = correct_ano_1 >> >> (I assume you wanted to insert the correct_anno_1 in position 1 of the >> array). >> >> Jesus. > > I actually want to insert rather than replace. Is there a way to do > that?? Use Array#insert. robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/