if I create this array:
a = Array.new(3,Array.new(2,0))
he creates:
=> [[0, 0], [0, 0], [0, 0]]
And when I try to change a specific item:
a[0][0] = 3
it changes several values:
=> [[3, 0], [3, 0], [3, 0]]
Why is this happening? And how can I change a specific item?
source
share