mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 05:58:20 +00:00

This is based on commit 99e6942efec5feff50523f6b2a1f5868f19ab638 from the zeek-docs repo.
19 lines
337 B
Text
19 lines
337 B
Text
module Factor;
|
|
|
|
function factorial(n: count): count
|
|
{
|
|
if ( n == 0 )
|
|
return 1;
|
|
else
|
|
return ( n * factorial(n - 1) );
|
|
}
|
|
|
|
event zeek_init()
|
|
{
|
|
local numbers: vector of count = vector(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
|
|
|
for ( n in numbers )
|
|
print fmt("%d", factorial(numbers[n]));
|
|
}
|
|
|
|
|