Kotlin - Control Flow as Expressions
Given a list of
Any objects, write a Kotlin function using when with smart casts to return a list of strings describing each element's type and value. What is the correct implementation?fun describeList(items: List): List { return items.map { item -> when (item) { is String -> "String of length ${'$'}{item.length}" is Int -> "Int with value ${'$'}item" else -> "Unknown type" } } }
