In a method definition, when * is used in the following manner, what does it mean?
def foo(*)
...
end
I understand the following usage:
def foo(*args)
...
end
I am not sure how I will access the method params in the former case.
It means "take and discard any number of parameters".
Both definitions are technically the same, but not giving a name to the argument array means you can't access it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With