Assignment not allow in while expression?


#41

That’s exactly how I write my code, too. I call it the early-return convention. In this case it is early-break.

Explanation: reduce the number of nested structures (especially nested if), by introducing returns as early as possible.


#42

Java 8 stream API could be useful
https://docs.oracle.com/javase/8/docs/api/java/io/BufferedReader.html#lines--


#43

Use this kind of code.

val reader = BufferedReader(reader)
var line = 1

while (line != null) {
  line = reader.readLine()
  if(line != null)
    System.out.println(line)
  else
    break
}