Defining an anonymous function that takes in a variable length of arguments

#1

I am trying to define an anonymous function that takes in a variable number of arguments.

val a = { (a: Int*) => 1}

The compiler gives the error :')' expected but identifier found.

For a method I would define a variable number of arguments this way :

def func(a : Int*) : Int =???

And this compiler. Why doesn’t it work for annonymous function?

#2

Unfortunately varargs syntax is not supported in anonymous functions.

#3

Ah…okay.