Guys. I can't decypher deep meening behind run extension funciton which has the form of public inline fun <R> run(block: () -> R): R = block() ? What is deep design thinking behind this
k
kingsley
10/03/2017, 12:32 PM
The advantage comes when you need a more involved initialization for a variable. For example:
Copy code
val something = run {
// Some complex init
// More logic
// result gets passed to something
}