Skip to content

Instantly share code, notes, and snippets.

@PatilShreyas

PatilShreyas/HOF2.kt Secret

Last active Dec 29, 2020
Embed
What would you like to do?
fun TextBuilder(builder: StringBuilder.() -> Unit): String {
return StringBuilder().apply(builder).toString()
}
fun main() {
val string = TextBuilder {
append("Welcome To Kotlin World")
append("\nEnjoy")
}
println(string)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment