Array.join for nested arrays


arr = [1, [2, [3, 4], 5], 6]

in Ruby 1.8.6 produces the following string:


Looking at the docs (e.g.,
Array.join should work as following:

“Returns a string created by converting each element of the array to a
string, separated by sep.”

Doing the following:

arr.each do |e|

However, this is not what I expected - I would have expected:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs