So I have to implement two different situations. One is a method that multiplies two numbers, and can also multiply more than 2 numbers.
I'm using the following:
def multiply(arr)
arr.reduce(1, :*)
end
So far it works out fine if I unit test using an array input. Is there anyway to do this so my method can take in just two values, or an array, and return the relevant results? Is there also a way to implement this without even using an array input?
def multiply(*arr); ...; end