How to code this right in Scala?
def myFun(strings: String*) = {
// do something...
}
def myWraper(strings: String*) = {
// do something else and then call myFun with the dame input
myFun(strings)
}
I've tried putting an asterisk like
def myWraper(strings: String*) = {
// do something else and then call myFun with the dame input
myFun(strings*)
}
But this doesn't seem to work...
Try this:
myFun(strings: _*)
You need to tell it to split strings
up across the varargs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With