ITP - files - simple_file.txt 3

Finally, lets insert more text into simple_file.txt:

irb :006 > File.open("simple_file.txt", "a+") do |file|
irb :007 >     file << "Here we are with a new line of text"
irb :008?>   end
 => #<File:simple_file.txt (closed)>
irb :009 > File.readlines("simple_file.txt").each do |line|
irb :010 >     puts line
irb :011?>   end
another example of writing to a file.
Here we are with a new line of text
 => ["another example of writing to a file.\n", "Here we are with a new
line of text"]