Slackbot
08/23/2019, 4:29 AMShawn
08/23/2019, 5:22 AMis
is used to check types of instances - if you want to match on a KClass<T>
then you just need to use when
like you would when comparing other valueswhen (type) {
String::class -> ...
Int::class -> ...
}
Mike
08/23/2019, 11:05 AMtype.length
have on a KClass even if it's wrapping a String?
Don't you want
val type:Any
when(type) {
is String -> println(type.length)
is Int -> prinlnt(type * 2)
is Boolean -> {}
else -> {}
}