What is the output?
fun String.twice(): String {
return this + this
}
fun main() {
val s = "Ko"
println(s.twice())
}
Try it in the online Kotlin Playground →
[spoiler title="Solution"]
Answer:
KoKo
Explanation:
Extension functions add new methods to existing types.
[/spoiler]