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
Post a Comment