(ruby 1.8.0 Linux)
I don’t understand why I get the following behavriour:
irb(main):001:0> matrix = Array.new( 3, Array.new( 4, 0 ) )
=> [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
irb(main):002:0> matrix[0][0] = 1
=> 1
irb(main):003:0> matrix
=> [[1, 0, 0, 0], [1, 0, 0, 0], [1, 0, 0, 0]]
irb(main):004:0>
I would have expected the assignment of matrix[0][0] to produce a matrix:
[[1,0,0,0],[0,0,0,0][0,0,0,0]]
What am I not getting here?
···
Plan your next US getaway to one of the super destinations here.
http://special.msn.com/local/hotdestinations.armx