> unknown wrote:
> > WKC CCC
> >> count = count + 1
> >> end
> >> puts one.inspect
> > Array.new(array) copies the *array* but it does not copy its *elements*.
> > So tempArr is another name for the very same object as one, and so
> > forth. m.
> If they are referring to the same object, why is it when
> tempArr = Array.new(one)
> results in tempArr still having the values originally assigned to array
Reread what I said. I didn't say that tempArr and one refer to the same
object; I said that tempArr and one (and so on) refer to the same
Think of it this way. Items in an array are dogs. Arrays are people
holding leashes. Anyone can attach a leash to a dog. So I (tempArr) can
have a leash on Fido, and so can you (one). If you let go of your leash
(one.clear), Fido is still Fido; you just don't have a leash on him. But
if you cut off one Fido's legs (modify one), that leg on my Fido
(tempArr) is also cut off, because they are the same Fido.
matt neuburg, phd = email@example.com, http://www.tidbits.com/matt/
Tiger - http://www.takecontrolbooks.com/tiger-customizing.html
AppleScript - http://www.amazon.com/gp/product/0596102119
Read TidBITS! It's free and smart. http://www.tidbits.com