Passing a Variable Number of Arguments
def putter(first_word, *others) puts first_word + " " + others.join(" ") end putter "Hello", "from", "Ruby."
1. | Variable Arguments | ||
2. | prefixing the array with an asterisk | ||
3. | A variable number of arguments stored in an array. | ||
4. | Mixed parameters and varied length parameter |