Ruby: Write Array elements as new line

2018-01-17 ·

Use puts with an array argument to write each elements on a new line:

arr = %w[a b c]

File.open("array.txt", "w+") do |f|
  f.puts(a)
end
Copyright © 2018 All rights reserved.
Powered by Kulfon.