From: Stefano Crocco Date: 2008-03-24T18:44:49+09:00 Subject: Re: Question about Array#* On Monday 24 March 2008, Magicloud Magiclouds wrote: > Hello, > In `ri 'Array#*'`, it says that the result is the concatenation of > copies of self if the argument is an int. > So, it is "COPY". > Then why something like '[[0]] * 10', returns an array, that each > element is a pointer to the first element? > Does this mean "copy of an Array" is just a duplicated pointer? > > Thanks. I think that here the word "copy" has the same meaning it has in clone and dup, that is it means a shallow copy: the array itself is copied, but its contents aren't. In other words, what you get using Array#* with a number is an array of size n times the original one, whose contents are the contents of the original array repeated n times. I hope this helps Stefano