mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
16 lines
235 B
Perl
16 lines
235 B
Perl
local test = require("test")
|
|
|
|
local Num = int
|
|
local terra fact(a : Num) : Num
|
|
var c,i = 1,1
|
|
while i <= a do
|
|
c = c * i
|
|
i = i + 1
|
|
end
|
|
return c
|
|
end
|
|
|
|
|
|
test.eq(fact(1),1)
|
|
test.eq(fact(2),2)
|
|
test.eq(fact(3),6) |