Salvatore Coluccia
Salvatore Coluccia

Reputation: 165

Usage of curly brackets at the end of function call kotlin

What does it change between these two calls? I tried and they have the same behaviour

unsortedInputValues.joinToString(","){it}

unsortedInputValues.joinToString(",")

Upvotes: 12

Views: 3801

Answers (1)

Alexander
Alexander

Reputation: 63399

That's a "trailing lambda", a language feature inspired by Ruby's block syntax.

Upvotes: 11

Related Questions