Hey I'm learning Kotlin using the Kotlin_Koans IDE course in Android Studio. I've just done a task about Data Classes but I'm so confused by what this class is supposed to be doing. It's comparing two names that are the same, despite having two different names in the list, why? I'll copy the correct answer below, then underneath I'll paste the 'task'.
data class Person(val name: String, val age: Int)
fun getPeople(): List<Person> {
return listOf(Person("Alice", 29), Person("Bob", 31))
}
fun comparePeople(): Boolean {
val p1 = Person("Alice", 29)
val p2 = Person("Alice", 29)
return p1 == p2 // should be true
}