monaco-editor/test/samples/sample.lua.txt

12 lines
257 B
Plaintext
Raw Normal View History

2016-06-10 01:25:58 +08:00
-- 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))