Jump to content

Module:Sandbox/sameboat2

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Sameboat (talk | contribs) at 05:08, 19 March 2013. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
  function factorial(n)
    if n == 0 then
      return 1 --this returns the result 1 when passed zero
    else
      return n * factorial(n - 1)
    end
  end
  for index = 1,5 do
      print(index, "n! = ", factorial(index) )
  end