📜  大于时的 Kotlin - Kotlin 代码示例

📅  最后修改于: 2022-03-11 14:53:31.990000             🧑  作者: Mango

代码示例1
We can use let to achieve this behaviour.

response.code().let {
    when {
        it == 200 -> handleSuccess()
        it == 401 -> handleUnauthorisedError()
        it >= 500 -> handleInternalServerError()
        else -> handleOtherErrors()
    }
}