Smart casting operator "is" and "!is" in kotlin

 


fun main(args: Array<String>) {
/* Smart Cast
for nullable types
is - !is - operator
*/

val obj: Any = 10
if(obj !is Long)
{
println("Obj is not string")
}
else
{
println("Obj is Long ${obj}")
}




}

Comments

Popular posts from this blog

Google Assistant Implementation in Android application with app actions