Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在调用方法时计算作为 splat 参数传递的值的数量?
def splat_demo(*var) #code to find out no of values in the splat variable here end
你得到一个数组,所以只需运行var.size以获取传入的值的数量。
var.size