Ruby Print Array
puts
and to_s
could be better:
a = [1, 2, 3]
puts a
> 1
> 2
> 3
puts a.to_s
> [1, 2, 3]
Nicely print an array
Multiply it out with spaces:
a = [1, 2, 3]
puts a * " "
> 1 2 3
Ruby
]
puts
and to_s
could be better:
a = [1, 2, 3]
puts a
> 1
> 2
> 3
puts a.to_s
> [1, 2, 3]
Multiply it out with spaces:
a = [1, 2, 3]
puts a * " "
> 1 2 3
Ruby
]