File.open("example.txt", "r") do |file| lines = file.readlines lines.each { |line| puts line } end