Solution 1:
There is no factorial function in the standard library.
Solution 2:
Like this is better
(1..n).inject(:*) || 1
There is no factorial function in the standard library.
Like this is better
(1..n).inject(:*) || 1