ruby – How to do a newline in output

ruby – How to do a newline in output

Use n instead of n

You can do this all in the File.open block:

Dir.chdir C:/Users/name/Music
music = Dir[C:/Users/name/Music/*.{mp3, MP3}]
puts what would you like to call the playlist?
playlist_name = gets.chomp + .m3u

File.open playlist_name, w do |f|
  music.each do |z|
    f.puts z
  end
end

ruby – How to do a newline in output

I would like to share my experience with n
I came to notice that n works as-

puts nn // to provide 2 new lines

but not

p nn

also
puts nn
Doesnt works.

Hope will work for you!!

Leave a Reply

Your email address will not be published.