Reputation: 1527
How can I display an array of array in a table (view) ?
matrix = Array.new(rows){Array.new(cols){0}}
like that:
0 0 0 0
0 0 0 0
0 0 0 0
Upvotes: 0
Views: 79
Reputation: 2302
matrix = Array.new(3){Array.new(4){0}}
puts matrix.map {|x| x.join(' ')}
0 0 0 0
0 0 0 0
0 0 0 0
Upvotes: 1