I have the following code, which hangs up on writing user input to a file. What is my error here?
file=File.open("Debsfile.txt", "r+") do |file|
file.puts "This is Deb's file. It's a great file. It has many characters, words and lines."
file.puts "This is another line of text in Deb's file."
end
puts "What is your favorite color?"
color = gets
color = color.chomp
color.write
file.close
File.open("Debsfile.txt").readlines.each do |line|
puts line
end