Complete the code to declare a Char variable holding the letter 'A'.
val letter: Char = '[1]'
In Kotlin, a Char is a single character enclosed in single quotes, like 'A'. Double quotes are for strings.
Complete the code to print the Unicode code of the Char 'Z'.
println([1].code)The Char 'Z' is written with single quotes. The code property gives its Unicode number.
Fix the error in the code to convert an Int to a Char.
val ch: Char = 65.[1]()
In Kotlin, to convert an Int to a Char, use the toChar() function.
Fill both blanks to create a map of characters to their Unicode codes for letters 'a' to 'c'.
val map = mapOf([1] to [2], 'b' to 'b'.code, 'c' to 'c'.code)
The key is the Char 'a' and the value is its Unicode code using .code.
Fill all three blanks to create a list of Chars from Unicode codes 65 to 67.
val chars = listOf([1](65), 66.[2](), 67.[3]())
Use Char(65) to create a Char from code 65, or convert Int to Char with toChar(). Here, Char(65) and 66.toChar() are valid.