在ruby中打印多维数组的首选方法是什么?
例如,假设我有这个2D数组:
x = [ [1, 2, 3], [4, 5, 6]]
Run Code Online (Sandbox Code Playgroud)
我尝试打印它:
>> print x
123456
Run Code Online (Sandbox Code Playgroud)
什么不起作用:
>> puts x
1
2
3
4
5
6
Run Code Online (Sandbox Code Playgroud)