+ 4
How to print nested array row by row?
Let say I have the following array: arr = [[2, 6], [3, 4]] Expected output: [2, 6] [3, 4] However, the following output appear instead. Code: print arr Output: [[2, 6], [3, 4]] Code: puts arr Output: 2 6 3 4
2 Answers
+ 5
Thanks. Loops working great.
for i in (0..arr.length-1)
print arr[i]
puts "\n"
end
+ 1
print arr[0]
puts
print arr [1]
you can do with loops also.