String each_with_index : each_with_index « String « Ruby






String each_with_index


s = ""
data.each_with_index { |x, i| s << x; s << "|" if i < data.length-1 }
puts s

 

Related examples in the same category