<I have a generic "checkType" function with args a...
# stackoverflow
u
I have a generic "checkType" function with args as parameter and then how to be able to return the value type according to attached parameters Examples are as follows: * input: checkType(10) output: "Yes! it's Integer" Here are some mandatory value types. • Integer • Strings • Boolean • Double • List • Map fun checkType(args: T): String { return "" } fun main() { println( """ '[10, 9, 8 , 6]' is List? ${checkType(listOf(10, 9, 8, 6))} 'Kotlin' is String? ${checkType("Kotlin")} 'True' is Boolean? ${checkType(true)} '10.01' is List? ${checkType(10.01)} """.trimIndent() ) }