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

Reading Files

Lesson 26
Author : GOUP
Last Updated : September, 2020


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()