Mega Code Archive

 
Categories / Ruby / Statement
 

Begin

names=IO.readlines("C:\\customer_details1.txt")     count=names.length     for i in 0...count          puts "The contents of the file are #{names[i]}"     end     rescue          $stderr.puts "error"          puts "The error occurred is #{$!}" end