On Wed, Jul 28, 2010 at 2:26 PM, Dave Castellano
<dcastellano1 / wideopenwest.com> wrote:
> Jes=FAs Gabriel y Gal=E1n wrote:
>> On Wed, Jul 28, 2010 at 1:10 PM, Robert Klemme
>> <shortcutter / googlemail.com> wrote:
>>
>>> Use Array#insert.
>>
>> Amazing how I missed that, given that I was specifically looking for
>> it in the rdoc :D
>> I call "sleep deprived", or something
>>
>> Jesus.
>
> That works for single dimension arrays but I can't figure out the syntax
> for multi...
>
> I have been trying to use "answer_choices.insert" but cannot figure out
> the syntax
> eg answer_choices.insert([x][1],correct_ans_1) does not work..
>
> Could you give me an example of Array#insert. using multidim. array

In order to better understand it, I'm afraid you will need to stop
thinking about multidimensional arrays, and start thinking of arrays
of arrays. First you need to get the inner array:

answer_choices[x]

then you get back an array. It's on this inner array where you want to
insert, so (split in two steps):

inner =3D answer_choices[x]
inner.insert(0, correct_ans_1)

Jesus.