How to use kotlin extension functions?

Kotlin provides a way to extend a class without modifying its source code, called Extension Functions. This is how you can add new functions to existing types:


  fun String.reverse(): String = this.reversed()
  println("Kotlin".reverse())
  

Beginner's Guide to Kotlin