<Elvis operator (?:) always returns the left opera...
# forum
r
Elvis operator (?:) always returns the left operand (.toString()) Given the following code : val statusCode: String = result?.httpStatusCode?.statusCode.toString() ?: Response.Status.NO_CONTENT.statusCode.toString() Why do I get the error : Elvis operator (? always returns the left operand of non-nullable type String If I understand the “?” correctly, result could be null or httpStatusCode could be null and therefore the toString function could never be called, requiring the right side of the operator? 1 post - 1 participant...