Can i combine varargs with lambda? It seems its no...
# announcements
j
Can i combine varargs with lambda? It seems its not possible to define a varargs in kotlin, am i missing something for example
Copy code
val varArgsFunction = createVarArgsFunction("foo")
varArgsFunction(1, 2, 3)
k
Trying
Copy code
fun foo(vararg x: Int) {}
val f = ::foo
shows the type of
f
to be
(IntArray) -> Unit
, so not it's not possible. Use arrays instead.
j
ok thx for your reply