How do I print a multi-dimensional array in ruby?
If you're just looking for debugging output that is easy to read, "p" is useful (it calls inspect() on the array)
p x[[1, 2, 3], [4, 5, 6]]
If you want to take your multi-dimensional array and present it as a visual representation of a two dimensional graph, this works nicely:
x.each do |r| puts r.each { |p| p }.join(" ")end
Then you end with something like this in your terminal:
1 2 3 4 5 6 7 8 9