var num: Int = 2 when (num) { 1 -> println("num:1") 2 -> println("num:2") 3 -> println("num:3") }
出力
I/System.out: num:2
val name = if (id = 10) "taro" else "none"