Writing to Files : puts « File Directory « Ruby






Writing to Files



File.open("text.txt", "w") do |f|
  f.puts "This is a test"
end

 

Related examples in the same category

1.Picking a Random Line from a File