Complete the code to declare a variable that can hold any type of value.
val value: [1] = 42
The Any type in Kotlin is the universal base type that can hold any value.
Complete the code to assign a string value to a variable of type Any.
val data: Any = [1]You can assign any value to a variable of type Any. Here, a string literal "Hello" is assigned.
Fix the error in the code by choosing the correct type for the variable that can hold any value.
var item: [1] = 3.14
The variable item should be of type Any to hold any value, including a Double.
Fill both blanks to create a function that accepts any type and returns its string representation.
fun describe(value: [1]): [2] = value.toString()
The function parameter is of type Any to accept any value, and it returns a String representation.
Fill all three blanks to create a list of Any type and add different types of elements.
val items = mutableListOf<[1]>() items.add([2]) items.add([3])
The list is of type Any to hold any kind of element. We add a string and an integer to it.