Kotlin setOnclickListener

前端 未结 2 1672
夕颜
夕颜 2021-02-09 01:19

Back in java I used to write only return for a void method... But kotlin doesn\'t seem to allow just return, instead it uses return@methodname? Can som

2条回答
  •  情话喂你
    2021-02-09 01:29

    When inside a lambda, you have to specify which scope you wish to return from, because it might be ambiguous. See the official docs about returning at labels.

    In this specific case, if you'd be returning at the end of a function that returns nothing, you can omit the return statement altogether.

提交回复
热议问题