algorithms/factorial_iterative.rb

tests/_examples/algorithms/factorial_iterative.rb in the metorex repository.

n = 6
result = 1

(2..n).each do |value|
  result *= value
end

puts result

Output:

720