fun a(vararg options: String) {
b(*options.toList().plus("hi").toTypedArray())
}
fun b(vararg options: String) {
}
Also why does options.plus(“hi”) not work?
fun a(vararg options: String) {
b(*options.toList().plus("hi").toTypedArray())
}
fun b(vararg options: String) {
}
Also why does options.plus(“hi”) not work?
Your going to need to be a little more specific. This works
fun a(vararg options: String): String {
return b(*options.toList().plus("hi").toTypedArray())
}
fun b(vararg options: String): String {
return options.joinToString();
}
fun main() {
println(a("a"))
}
EDIT: Btw I think this is what your looking for?
fun a(vararg options: String): String {
return b(*options, "hi")
}
fun b(vararg options: String): String {
return options.joinToString();
}
fun main() {
println(a("a"))
}
Since both of you linked to the kotlin playground. You can just set the language of the code snippets here to run-kotlin and the code is embedded like this
fun main(){
//sampleStart
println("hi")
//sampleEnd
}
You still need to create a main
function but you can hide it with //sampleStart
and //sampleEnd
Yes thanks!