How will I know how many rows are there in a file? Should I make a function to read how many rows are there in the file and store it in a variable and then use it later on?

Do you have any samples or examples that you can show me?

Thanks for your time.