I would like to use a block function like this one...
# getting-started
d
I would like to use a block function like this one inside an extension function:
Copy code
fun MyModel.anExtensionFunction() {
	objectLambda {
	     it.getText()
	}
}
where it is the obj property of the MyModel class How should I write the objectLambda function in order to do so?
Copy code
class MyModel {
    var obj = MyObject()
    fun objectLambda() {
         // HOW SHOULD I WRITE THIS FUNCTION?
    }
}

class MyObject {
    fun getText() = "myText"
}
e
well it wants to take the lambda block as an argument, right?
Copy code
fun objectLambda(block: (MyObject) -> Unit) {
    block(obj)
}
👍 1
d
thanks