Kotlin Tutorial – Learn how to read file content as a list of lines in Kotlin. Kotlin Example is provided with File.readLines() to read content line by line from file.

Function to be used to read the lines from file :

File.readLines()Reads file content as a list of lines

Read file content as a list of lines in Kotlin – Kotlin Example

Read lines in Text file

Contents of file is shown below :

Hello World.
Welcome to Kotlin Tutorial by www.tutorialkart.com.
Learning Kotlin is easy.

Conclusion :

In this Kotlin Tutorial – Kotlin Read File to Lines, we have learnt to read content of file line by line. In our next tutorial, we shall learn to write data to file.