Ruby - Programming Language
This course covers the basics of programming in Ruby. Work your way through the videos and we'll teach you everything you need to know to start your programming journey!

Reading Files

Lesson 26
Author : Mike Dane
Last Updated : November, 2017


Code

CopyFile.open("employees.txt", "r") do |file|
     for line in file.readlines()
          puts line
     end
end

# ---------------
# or
# ---------------

file = File.open("employees.txt", "r")

puts file.read

file.close()