Exit onClickListener in Kotlin

Viewed 1639

I have a conditional on a button click and if conditions are met I want to exit the listener. What is the proper way to exit the method? Return doesn't seem to work..

btnApplyPayment.setOnClickListener {
    if (isFloat(strAmount))            
       //exit here
1 Answers
btnApplyPayment.setOnClickListener {
    if (isFloat(strAmount))            
       return@setOnClickListener
 }

See this for reference.

Related