3 ms·
It's an ordinary function: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/with.html https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/with.htm...
by ptx 9y ago
It's an ordinary function: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/with.html https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/with.htm...
- swsieber 9y agoThank you - searching for the word with was unfruitful for me.
- pdpi 9y agoThis is a recurring theme with Kotlin: inline receiver functions with a lambda parameter are an amazingly versatile tool for building functions that implement what would be a language feature/syntactic sugar in other languages. `with` here is a good example, but `let` and `use` are other good examples of this in play (`use` gives you try-with-resource, let plays nicely with the ?. safe navigation operator to execute code on non-null objects `maybeNullObject?.let { doStuffWith(it) }`)