fun main(args: Array<String>) { val x:Int=5 when (x) { 1 -> print("x == 1") 2 -> print("x == 2") else -> { // Note the block print("x is neither 1 nor 2") } } }
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more