--Apple-Mail-23--307016069 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On 12 Apr 2005, at 00:12, Daun Jaun wrote: > statArr > for i in 0...3 > statArr[i] > for j in 0...3 > statArr[i][j] > for k in 0...2 > statArr[i][j][k] > end > end > end > > p statArr > statArr[0][2][1]+0> statArr[1][0][0]+ > statArr[2][2][1]+> p statArr > > statArr ¨Âáù®îå÷¨³¬Áòòáù®îå÷¨³¬Áòòáù®îå÷¨²¬°©© Here you asked Ruby to create an Array containing three copies of the same Array, not three different Arrays. try stat_arr rray.new 3 { Array.new 3 { Array.new 2, 0 }} > p statArr > statArr[0][2][1]+0> statArr[1][0][0]+ > statArr[2][2][1]+> p statArr > > > what is going on in the above code why is there the discrepancy in the > output > is it a bug or paraller processing feature It is your bug :) -- Eric Hodel - drbrain / segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --Apple-Mail-23--307016069 content-type: application/pgp-signature; x-mac-type=70674453; name P.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) iEYEARECAAYFAkJbe4YACgkQMypVHHlsnwSVTACfRi+r8BfjLVFWTx8Jjap9qLHf IHsAnjhgvWvmne0nybjduZabUSbPYdgD ÙÓN -----END PGP SIGNATURE----- --Apple-Mail-23--307016069--