martmists
someFunction( // takes varargs *arrayOf(if (condition) "someValue" else null).filterNotNull().toTypedArray(), )
wbertan
listOfNotNull
ephemient
someFunction( *if (condition) arrayOf("someValue") else emptyArray() )
Klitos Kyriacou
if (condition) someFunction("someValue") else someFunction()
Alan B
fun anotherFunction(condition: Boolean) = if (condition) arrayOf("someValue") else emptyArray()
someFunction(*anotherFunction(condition))
A modern programming language that makes developers happier.