Complete the code to declare an infix function named to.
infix fun String.[1](other: String): Pair<String, String> = Pair(this, other)The infix function to allows you to write expressions like "a" to "b" to create pairs.
Complete the code to call the infix function to to create a pair.
val pair = "key" [1] "value"
The infix function to is called without dots or parentheses, like "key" to "value".
Fix the error in the infix function declaration by completing the code.
infix fun [1].to(other: String): Pair<String, String> = Pair(this, other)The infix function to is declared as an extension on String to pair two strings.
Fill both blanks to create an infix function connect that joins two strings with a dash.
infix fun String.[1](other: String): String = this [2] "-" + other
* which is invalid for strings.The infix function connect concatenates two strings with a dash using the + operator.
Fill all three blanks to create a DSL that uses infix functions to build a map.
val map = mapOf(
"one" [1] 1,
"two" [2] 2,
"three" [3] 3
)-> which is not an infix function here.The to infix function is used to create pairs inside mapOf to build a map.