title: How can I use a while loop in Kotlin to iterate through a BufferedReader and append to a StringBuilder?
body: <p>Here is some code I ported over from Java:</p>
  
  <pre><code>var audioDataString = ""
          val jsonReader = BufferedReader(InputStreamReader(context.resources.openRawResource(resourceName)))
          val jsonBuilder = StringBuilder()
          var line: String? = null
          while ((line = jsonReader.readLine()) != null) {
              jsonBuilder.append(line).append("")
          }
  </code></pre>
  
  <p>The "<em>(line = jsonReader.readLine())"</em> gives me the following error: Assingments are not expressions, and only expressions are allowed in this context.</p>
  
  <p>How do I do this correctly in Kotlin?</p>
  
  <p>Thanks. </p>