Complete the code to declare a variable with type inferred by the compiler.
val number = [1]The compiler infers the type of number as Int because the value 42 is an integer.
Complete the code to declare a variable with type inferred as String.
val greeting = [1]The compiler infers the type of greeting as String because the value is a text inside quotes.
Fix the error by completing the code to declare a variable with type inferred as Boolean.
val isActive = [1]The compiler infers isActive as Boolean because the value true is a boolean literal, not a string.
Fill both blanks to create a list with type inferred by the compiler.
val numbers = listOf([1], [2])
The list contains integers 1 and 3, so the compiler infers the list type as List<Int>.
Fill all three blanks to create a map with type inferred by the compiler.
val map = mapOf([1] to [2], [3] to 42)
The map has keys as strings "one" and "two", and values as integers 1 and 42. The compiler infers the type as Map<String, Int>.