摘要:
fun getColorType() : String { val color = getUpperFavoriteColor() return when (color) { "" -> "empty" "RED", "GREEN", "BLUE" -> "rgb" else -> "other" 阅读全文
posted @ 2020-10-28 20:58
Zhentiw
阅读(128)
评论(0)
推荐(0)
摘要:
Let function is another way to solve null problem in kotlin. When you have such problem: var favoriteColor: String? = null...... return if f(avoriteCo 阅读全文
posted @ 2020-10-28 20:54
Zhentiw
阅读(63)
评论(0)
推荐(0)
摘要:
In Javascript, we have: return age null ? -1 : age In kotlin, we can do the same thing with a better / simpler syntax: val safeAge: Int get() = age ?: 阅读全文
posted @ 2020-10-28 20:37
Zhentiw
阅读(123)
评论(0)
推荐(0)

浙公网安备 33010602011771号