ruby - Printing elements of an array with a comma -


i have array arr = ["test", "test 1", "test 2"]. how print test, test 1, test 2.? note "." , "," in expected output.

i know how iterate on doing:

arr.each |a|     puts end 

but i'm not sure how expected output.

puts arr.join(' , ')+'.' 

with trailing period.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -