Comparing a character with its Unicode representation

Report a typo

Suppose you're building a system in Kotlin that needs to compare Unicode characters. You need to find out if a particular character is the same as its Unicode representation. Fill the blanks in the code snippet to compare a hardcoded character with its Unicode equivalent and print the result.

Fill in the gaps with the relevant elements
fun main() {
     char1 = ''
    val char2 = '\u004B'
    if (char1 == char2) {
        println("Both are same")
    } else {
        println("Both are different")
    }
}
valK
___

Create a free account to access the full topic