mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
21 lines
325 B
Perl
21 lines
325 B
Perl
terra iseven(a : uint) : bool
|
|
if a == 0 then
|
|
return true
|
|
else
|
|
return isodd(a - 1)
|
|
end
|
|
end and
|
|
terra isodd(a : uint) : bool
|
|
if a == 0 then
|
|
return false
|
|
else
|
|
return iseven(a - 1)
|
|
end
|
|
end
|
|
|
|
local test = require("test")
|
|
test.eq(iseven(3),false)
|
|
test.eq(iseven(2),true)
|
|
test.eq(isodd(3),true)
|
|
test.eq(isodd(2),false)
|