Last active
August 9, 2016 10:45
-
-
Save kittinunf/8a23083b9e996d144f4de787f23f02ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun doSomething(path: String) { | |
val content: String //instead of declare as `var content: String? = null` | |
val br = BufferedReader(FileReader(path)) | |
var currentLine = br.readLine() | |
content = buildString { | |
while (currentLine != null) { | |
appendln(currentLine) | |
currentLine = br.readLine() | |
} | |
} | |
println(content) //print all content | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment