Introduction
We use File.readlines to read a file one line at a time into a list. This helps us work with each line separately.
When you want to read a text file and process each line individually.
When you need to count or analyze lines in a file.
When you want to display or print each line from a file.
When you want to store all lines from a file in an array for later use.