Changes between Version 4 and Version 5 of SummaryRuby
- Timestamp:
- Nov 15, 2014, 3:46:14 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
SummaryRuby
v4 v5 605 605 f.pos = 8 606 606 puts "position in file has moved to: " + f.pos 607 f.close # close the file when finish! 607 608 608 609 # by using File.open in a block, is not needed to close the file when finish 609 File.open("text.txt", "w") do | entry| entry.puts "Hi" end610 File.open("text.txt", "w") do |file| file.puts "Hi" end 610 611 # note that the next line is invalid, if you put a space before ( then is not an argument list what you pass to it 611 #File.open ("text.txt", "w") do | entry| entry.puts "Hi" end612 #File.open ("text.txt", "w") do |file| file.puts "Hi" end 612 613 613 614 # appending