Course Content
test kotlin
test kotlin
1
Main
class Person(val name: String) { private val friends = mutableListOf<Person>() fun getFriends() : List<Person>{ return friends; } infix fun befriend(person: Person) { friends.add(person) println("${this.name} is now friends with ${person.name}") } } fun main() { val alice = Person("Alice") val bob = Person("Bob") alice befriend bob println(alice.getFriends()) }
Everything was clear?
Thanks for your feedback!
Section 1. Chapter 1