Understanding… private val onPurchase: (Purchase) -> Unit

Ok, this time I have a specific question about kotlin :)))

In one code i’ve seen this:

private val onPurchase: (Purchase) -> Unit

…and then later in the code i saw:

onPurchase(purchase)

So.. My question is… How can i transform this “onPurchase(purchase) ” on spot where it stands, so that I dont have to have in the code the upper line private val onPurchase: (Purchase) -> Unit?

submitted by /u/KotlinNoob
[link] [comments]