crayon-syntax-highlighter/util/sample/ruby.txt

9 lines
225 B
Plaintext
Raw Normal View History

2019-08-30 19:30:19 +02:00
# 'w' denotes "write mode".
File.open('file.txt', 'w') do |file|
file.puts 'Wrote some text.'
end # File is automatically closed here
File.readlines('file.txt').each do |line|
puts line
end
# => Wrote some text.