mirror of
https://github.com/CPunch/Cosmo.git
synced 2024-11-22 15:30:06 +00:00
29 lines
460 B
Plaintext
29 lines
460 B
Plaintext
proto test
|
|
function __init(self, x)
|
|
self.setArg(x)
|
|
end
|
|
|
|
function fact(self)
|
|
var total = 1
|
|
|
|
for (var i = self.x; i > 0; i = i - 1) do
|
|
total = total * i;
|
|
end
|
|
|
|
return total
|
|
end
|
|
|
|
function setArg(self, x)
|
|
self.x = x
|
|
end
|
|
end
|
|
|
|
var t = test(1)
|
|
|
|
for (var x = 1; x < 1000; x = x + 1) do
|
|
for (var i = 1; i < 100; i = i + 1) do
|
|
t.setArg(i)
|
|
|
|
print(t.fact())
|
|
end
|
|
end |