title: Clean way of reading all input lines in Kotlin
body: <p>A common pattern when doing coding challenges is to read many lines of input. Assuming you don't know in advance how many lines, you want to read until EOF (readLine returns null).</p>
  
  <p>Also as a preface, I don't want to rely on java.utils.* since I'm coding in KotlinNative, so no Scanner.</p>
  
  <p>I would like to maybe do something like</p>
  
  <pre><code>val lines = arrayListOf&lt;String&gt;()
  for (var line = readLine(); line != null; line = readLine()) {
      lines.add(line)
  }
  </code></pre>
  
  <p>But that clearly isn't valid Kotlin. The cleanest I can come up with is:</p>
  
  <pre><code>while (true) {
      val line = readLine()
      if (line == null) break
      lines.add(line)
  }
  </code></pre>
  
  <p>This works, but it just doesn't seem very idiomatic. Is there a better way to read all lines into an array, without using a while/break loop?</p>