summaryrefslogtreecommitdiff
path: root/AppPkg/Applications/Lua/scripts/Fact.lua
blob: b935c7a04f2bce36972f7e44be10459c2c7940a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
-- defines a factorial function
function fact (n)
  if n == 0 then
    return 1
  else
    return n * fact(n-1)
  end
end

print("enter a number:")
a = io.read("*number")        -- read a number
print(fact(a))