title: how to do check the boolean result after assignment in kotlin?
body: <p>update: thanks for point out the anwser in elariler question, for complete this question here, the answer is:</p>
  
  <pre><code>while ((reader.read(buffer).let {pointer = it; it != -1}) ) {
                  writer.write(buffer, 0, pointer)
              }
  </code></pre>
  
  <p>Was trying to read something from buffer in a while loop, in Java is done with one line: </p>
  
  <pre><code>while ((pointer = reader.read(buffer)) != -1)
  </code></pre>
  
  <p>but in kotling it gets error: Error:(46, 21) Assignments are not expressions, and only expressions are allowed in this context</p>
  
  <p>how to to the same thing with kotlin?</p>
  
  <pre><code>val reader = BufferedReader(InputStreamReader(inputStream, "UTF-8"))
          var pointer: Int
  
          while ((pointer = reader.read(buffer)) != -1) {
              writer.write(buffer, 0, pointer)
          }
  </code></pre>