Ruby - File IO
Identify the error in this Ruby code snippet:
file = File.open('log.txt', 'w') do |f|
f.puts 'Log entry'
end
file.puts 'Another entry'file = File.open('log.txt', 'w') do |f|
f.puts 'Log entry'
end
file.puts 'Another entry'f.puts returns nil. So calling file.puts causes an error.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions