Defined two functions like this.
fun foo(inputFoo: IntArray.() -> Unit) {
}
fun test() {
}
inputFoo is a IntArray’s function.
But we can invoke by foo { test() }
Defined two functions like this.
fun foo(inputFoo: IntArray.() -> Unit) {
}
fun test() {
}
inputFoo is a IntArray’s function.
But we can invoke by foo { test() }
This topic is convered in Function Literals with receiver.
Basically you are defining an extension function over IntArray with IntArray.() -> Unit.
So in the body of the lambda function, where you now call foo(), you can also directly call IntArray functions.