From: Erard Sebastien Date: 2006-04-20T01:03:25+09:00 Subject: Probleme with 2-dimensionnal arrays I can't understand why this piece of code doesn't return the array expected ? my_array = Array.new(3, Array(3)) 3.times do |i| 3.times do [j| my_array[i][j] = i + j end end it should return : [[ 0, 1, 2] [1, 2, 3] [2, 3, 4]] but it returns : [[2, 3, 4] [2, 3, 4] [2, 3, 4]] Is my code wrong ? If so how could I build the expected array ? Thank you -- Posted via http://www.ruby-forum.com/.