How to convert Java assignment expression to Kotlin
<p>Something in java like </p>

<pre><code>int a = 1, b = 2, c = 1;
if ((a = b) !=c){
    System.out.print(true);
}
</code></pre>

<p>now it should be converted to kotlin like</p>

<pre><code>var a:Int? = 1
var b:Int? = 2
var c:Int? = 1
if ( (a = b) != c)
    print(true)
</code></pre>

<p>but it's not correct.</p>

<p>Here is the error I get:</p>

<pre><code>in " (a=b)" Error:(99, 9) Kotlin: Assignments are not expressions, and only expressions are allowed in this context
</code></pre>

<p>Actually the code above is just an example to clarify the problem. Here is my original code:</p>

<pre><code>fun readFile(path: String): Unit { 
    var input: InputStream = FileInputStream(path) 
    var string: String = "" 
    var tmp: Int = -1 
    var bytes: ByteArray = ByteArray(1024) 

    while((tmp=input.read(bytes))!=-1) { } 
}
</code></pre>