From: "John W. Long" Date: 2003-09-14T11:49:07+09:00 Subject: Re: Ruby Object Model bothering me Hi Kurt, > Ok, so I did > > a = Array.new(number, []) > > It's really bothering me that if I do a[i] = n, all of a is now n. > > Is there a graceful way to get around this? I'm not sure what you are trying to do here. Maybe you could give a more detailed description of your problem? If you are trying to create a new array you have a couple of options. The default way to construct an array: a = [1,2,3] If you want to create an empty array that is a certain size: a = Array.new(5) #=> [nil, nil, nil, nil, nil] If you want to create an array that is a certain size and all the elements have the same value: a = Array.new(3, "pickles") #=> ["pickles", "pickles", "pickles"] -- John Long