By-name repeated parameters

Posted by Green Hyena on Stack Overflow See other posts from Stack Overflow or by Green Hyena
Published on 2010-04-25T04:46:55Z Indexed on 2010/04/25 4:53 UTC
Read the original article Hit count: 256

How to pass by-name repeated parameters in Scala?

The following code fails to work:

scala> def foo(s: (=> String)*) = {
<console>:1: error: no by-name parameter type allowed here
       def foo(s: (=> String)*) = {
                   ^

Is there any other way I could pass a variable number of by name parameters to the method?

© Stack Overflow or respective owner

Related posts about scala

Related posts about varargs