0

How can I count the number of values being passed as a splat argument while calling a method?

def splat_demo(*var)
   #code to find out no of values in the splat variable here
end
tekina
  • 571
  • 10
  • 21

1 Answers1

1

You get an array so just run var.size to get number of values that were passed in.

Pafjo
  • 4,979
  • 3
  • 23
  • 31