* Andrew Walrond <andrew / walrond.org> [030612 15:02]: > > > Rasputin wrote: > >This has me confused (It's getting to be a frequent experience). > > > >----------------8<---------------- > > > >SPACE = 1 > > > >a = Array.new(5) > >b = Array.new(5, SPACE) > > > >a.each { |el| > > el = SPACE > >} > > > > el is simply a reference to the array element. by el = SPACE simply > makes el refer to SPACE instead; it has no effect on the array element > > remember that pretty much everything is a reference and you won't go far > wrong I thought so, until this happened! The array was full of references, so I thought el held the reference from the Array. It seems to hold a copy of the reference... hmm, fiddly. I'll go for the collect! (aka map!) fix that I mentioned (and Joel suggested too, thanks). (This is from a noughts and crosses / tic-tac-toe board class I'm writing using ruby-libneural, so I need to clear the board after every game, otherwise I'd use the second Array constructor instead). Thanks to all repleyers (is that a word?) :) -- Rasputin :: Jack of All Trades - Master of Nuns