I have an array, i would like to concat all less the first one element
for example
[1,2,3,4,5] the result should be 2345
i tried to do this but does not worked row.join("")
CodePudding user response:
Try these
[1,2,3,4,5].drop(1).join
=> "2345"
[1,2,3,4,5][1..-1].join
=> "2345"
CodePudding user response:
You can use:
yourList = [1,2,3,4,5]
yourList.shift
puts "#{yourList.join("")}\n\n"
OUTPUT: 2345
