Assignments are not expressions and only expressions are allowed in this context


#1

Hi all, I´m beginning in Kotlin.
I got this error with this code. Can anyone help?

@Throws(IOException::class)
protected open fun readRawData(`in`: InputStream) {
    var b: Byte = 0
    val res = StringBuilder()

    // read until '>' arrives OR end of stream reached
    var c: Char
    // -1 if the end of the stream is reached
    while ((b = `in`.read().toByte()) > -1) {
        c = b.toChar()
        if (c == '>')
        // read until '>' arrives
        {
            break
        }
        val append = res.append(c)
    }

#2

This was already discussed here