What is this syntax?


#1

val (_,time) = time { Thread.sleep(1000) }

I see the Left Hand Side (LHS) has a val, so its declaring a variable. LHS also has some kind of a function syntax which does not look like a lambda declaration. What is (_,time). Don’t you have to give a type to the time on the LHS? I understand the RHS perfectly well: it is a function which accepts a lambda as parameter and is named ‘time’.


#2

https://kotlinlang.org/docs/reference/multi-declarations.html


#3

Thanks!