Accessing a value in a method using *

后端 未结 2 1417
花落未央
花落未央 2021-01-20 13:49

In a method definition, when * is used in the following manner, what does it mean?

def foo(*)
   ...
end

I understand the foll

2条回答
  •  清歌不尽
    2021-01-20 14:12

    In the first case it just allows calling with arbitrary arguments and discards them.

    The second case assigns any called arguments to args

提交回复
热议问题