How do I check if two Strings are equal valued in Kotlin?

Solution

Using == (double equal to) operator.


fun main(args: Array<String>) {
    val a: String = "kotlin is easy"
    val b: String = "kotlin is" + " easy"
    
    if (a == b) {
       println(" a and b are equal.")
    } else {
       println(" a and b are not equal.")
    }
}