摘要:
Array is mutable, but fixed length. Which means you can modify items in the Array, but you cannot add / remove item; // Array is fixed length, you can 阅读全文
posted @ 2020-10-11 19:55
Zhentiw
阅读(498)
评论(0)
推荐(0)
摘要:
Difference between "when" and Javascript "switch". In Switch, you have to call "break"; but "when", you don't need to. In Switch, the case expression 阅读全文
posted @ 2020-10-11 02:21
Zhentiw
阅读(68)
评论(0)
推荐(0)
摘要:
fun main() { val mode = 2 val result = when (mode) { 1 -> "1 is ok" 2 -> { println("2 is fine") val i: Int = 3 "return string 2 is fine" } else -> "la 阅读全文
posted @ 2020-10-11 02:14
Zhentiw
阅读(62)
评论(0)
推荐(0)
摘要:
fun main() { val mode = 3 when (mode) { 1 -> print("1 is ok") 2 -> { print("2 is fine") print("2 is fine") } else -> { print("large than 2 is not ok") 阅读全文
posted @ 2020-10-11 02:07
Zhentiw
阅读(64)
评论(0)
推荐(0)
摘要:
In Kotlin, it helps to avoid null reference, which means by default you cannot assign null value to any variable; But if you do want to assign null to 阅读全文
posted @ 2020-10-11 01:56
Zhentiw
阅读(116)
评论(0)
推荐(0)
摘要:
fun main() { val a = 4 val b: Byte = 127 val c: Short = 123 val d: Int = 7 val e: Long = 123456789 val f: Float = 3.73f val g: Double = 3.73 val h: Ch 阅读全文
posted @ 2020-10-11 01:48
Zhentiw
阅读(84)
评论(0)
推荐(0)
摘要:
using 'var', variable can be reassigned. using 'val', variable cannot be ressiagned. the same as Javascript 'const'. 阅读全文
posted @ 2020-10-11 01:32
Zhentiw
阅读(89)
评论(0)
推荐(0)

浙公网安备 33010602011771号