A lambda expression can receive parameters. The same sort of list of parameters that you can put in a function declaration can go at the start of the lambda expression, separated from the Kotlin statements by an arrow (->). You can then refer to those parameters from those Kotlin statements.

To supply values for the parameters, add them to your call to invoke().

If your lambda expression needs just one parameter, you can skip the parameter list and refer to the parameter as it.

You can learn more about this in:
Run Expand Edit