title: Can't get factorial function to work
body: <p>Factorial 1 and 2 works but 3 and 4 do not. I've worked the steps out on paper and do not see why they do not work. Any help is much appreciated. </p>
  
  <pre><code>def factorial(n)
    x = 1
    y = n
  
    while x &lt; n
      n = n * (y-x)
      x = x + 1
    end
    return n
  end
  
  puts("factorial(1) == 1: #{factorial(1) == 1}")
  puts("factorial(2) == 2: #{factorial(2) == 2}")
  puts("factorial(3) == 6: #{factorial(3) == 6}")
  puts("factorial(4) == 24: #{factorial(4) == 24}")
  </code></pre>