Passing repeated parametersThe type of the repeated parameter inside the function is an Array of the declared type of the parameter. Nevertheless, if you have an array of the appropriate type, and attempt to pass it as a repeated parameter, you'll get a compiler error:
To accomplish this, you'll need to append the array argument with a colon and an _* symbol, like this:
scala> val arr = Array("What's", "up", "doc?") arr: Array[java.lang.String] = Array(What's, up, doc?) scala> echo(arr)
:7: error: type mismatch; found : Array[java.lang.String] required: String echo(arr) ^
This notation tells the compiler to pass each element of arr as its own argument to echo, rather than all of it as a single argument.
scala> echo(arr: _*) What's up doc?
Read more: Repeated parameters