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
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