0

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

1 Answer 1

1
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
Sign up to request clarification or add additional context in comments.

1 Comment

but I want put this matrix in a view!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.