The splat operator can be used to create methods that accept a variable number of arguments. Here is how to create a method that adds a variable number of numbers passed as arguments. def add(*nums) nums.inject(&:+) end >> add(1, 2) => 3 >> add(1, 2, 3, 4) => 10 The arguments collected by the splat operator will be accessible as an array in the method body. def show_args(*args) args end >> show_ar
![Ruby’s splat operator](https://cdn-ak-scissors.b.st-hatena.com/image/square/8d71ff5111e05619a10d29bb40d7aebaa75c8fbc/height=288;version=1;width=512/https%3A%2F%2Fs0.wp.com%2Fi%2Fblank.jpg)