Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Ruby append to file


if ARGV.length != 1
  puts "Usage: #{$0} FILENAME"
  exit
end

filename = ARGV[0]
File.write(filename, 'My second line\n', mode: 'a')
File.open("data.txt", "a") do|fh|
  fh.puts "Hello"
end