07-20-2023, 07:04 AM
I'd like to define a function `f()` as follows (just an example) :
val f: (vararg strings: String) -> Unit = { for (str in it) println(str) }
so that I could invoke it with `f("a","b","c")`. For the above definition of `f()` I get the compilation error, pointing at the `vararg` modifier (Kotlin v. 1.3.60 ) :
Unsupported [modifier on parameter in function type]
How can I define a lambda that accepts a `vararg` parameter ?
val f: (vararg strings: String) -> Unit = { for (str in it) println(str) }
so that I could invoke it with `f("a","b","c")`. For the above definition of `f()` I get the compilation error, pointing at the `vararg` modifier (Kotlin v. 1.3.60 ) :
Unsupported [modifier on parameter in function type]
How can I define a lambda that accepts a `vararg` parameter ?