I am a newbie fascinated by Scala looking for a way of creating a method/function that takes a variable amount of functions as parameters.
Example with the * notation used in regular VarArgs
def someMethod(aNumber: Int, multipleFunctions: Int => Boolean*) = {
var flag = true
for (func <- multipleFunctions; if (!func(aNumber)) flag = false
flag
}
I realize I could accept an array of functions, but if that works it just feels like there must be a way of doing it with var args.
fns: Function1[Int, Boolean]*Int => Booleanin parentheses and that would solve the problem.