Is there a way have x amount of same parameters in Ruby?
Easiest way to ask this is, can you shorten this?
arr = [0,1,2,3]
if x == 1
return arr
elsif x == 2
return arr.product(arr)
elsif x == 3
return arr.product(arr, arr)
elsif x == 4
return arr.product(arr, arr, arr)
elsif x == 5
return arr.product(arr, arr, arr, arr)
end
*) to turn an array into sequential arguments. The posted answer includes a good example of this.