fun Int.print() = println(this) 5.print() // prints 5
fun Context.toast(text: CharSequence, duration: Int = Toast.LENGTH_SHORT): Toast { return Toast.makeText(this, text, duration).apply { show() } } toast("Hello Toast")
class AquariumPlant( val color: String) fun AquariumPlant.print() = println("Pretty Aquarium Plant") val plant = AquariumPlant("green") plant.print() // prints -> Pretty Aquarium Plant