Reputation: 29867
In Kotlin I would like to create a lambda that takes no parameters and returns nothing. I know how to do this when it takes a string parameter and returns nothing:
private var mOnTextWatcherCallback: ((m: String) -> Unit)? = null
But how do I do it for no parameters?
Upvotes: 2
Views: 2759
Reputation: 97130
Just use empty parentheses:
private var mOnTextWatcherCallback: (() -> Unit)? = null
// ^^
Upvotes: 10