I know what this means:
def f(*args)
...
end
But what does this mean and why would you want to use it? Can it appear with named paramete
def f(*)
has the same effect as def f(*args)
, except that it does not name the globbed argument array. You might use it if you want the function to accept any number of arguments but don't actually need to refer to them within the function -- for example, if you are overriding a method but calling super
without passing an explicit argument list, which results in the original arguments being passed to super
.
You can write def f(a, b, *)
as well.