..
To read the contents of the file you can use a simple loop:
# Opening and reading a text file
File.open ('test.txt', 'r') do | read |
while line = leggi.gets
puts line
# End of while loop
end
# End of method call
end
| |
Ruby and Ruby on Rails (Course)
Create software and Web applications with Ruby and RoR. From 39 €. |