4/16 arrays of arrays


multi_d_array = [[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]
multi_d_array.each { |x| puts "#{x}\n" }

How does the "#{x}\n" command work?


This is a Ruby string containing a value interpolation block and a newline escape sequence.


#{value or expression}

\n  newline escape sequence

The latter is how we insert a line break (a form of white space). The output of the above array will look like this,