var a = 1 if (a is Int) { println("$a 是Int 类型") } else { println("$a 不是Int 类型") }
如果判断是不是某种数据类型,可以用 is ,相当java中的 instanceof