What does the * (star) mean in Ruby? [duplicate] What does the * (star) mean in Ruby? [duplicate] ruby ruby

What does the * (star) mean in Ruby? [duplicate]


Variable Length Argument List, Asterisk Operator

The last parameter of a method may be preceded by an asterisk(*), which is sometimes called the 'splat' operator. This indicates that more parameters may be passed to the function. Those parameters are collected up and an array is created.

The asterisk operator may also precede an Array argument in a method call. In this case the Array will be expanded and the values passed in as if they were separated by commas.