mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 15:05:39 +01:00
12 lines
No EOL
257 B
Text
12 lines
No EOL
257 B
Text
-- 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)) |