Any thoughts on a Kotlin idiom to replace the foll...
# announcements
m
Any thoughts on a Kotlin idiom to replace the following Java which reads from a file line by line until it’s finished?
while ((line = reader.readLine()) != null) { ... }
In Kotlin, an assignment isn’t an expression so you can’t do that in the while’s conditional, so the direct replacement is:
Copy code
while (true) {
		line = reader.readLine();
		if (line == null) break;