What does the arrow (“->”) operator do in Kotlin?

前端 未结 3 1639
耶瑟儿~
耶瑟儿~ 2020-12-05 04:09

Probably a little bit broad question, but the official documentation doesn\'t even mentioning the arrow operator (or language construct, I don\'t know which phrase is more a

3条回答
  •  感动是毒
    2020-12-05 04:35

    From the Kotlin docs:

    ->

    • separates the parameters and body of a lambda expression

    • separates the parameters and return type declaration in a function type

    • separates the condition and body of a when expression branch

提交回复
热议问题