32 lines
685 B
Plaintext
32 lines
685 B
Plaintext
module: Math
|
|
function: main
|
|
params:
|
|
returns: int
|
|
body:
|
|
Math.factorial(6)
|
|
return 0
|
|
end body
|
|
end function
|
|
|
|
function: factorial
|
|
params:
|
|
declare n:int
|
|
returns: int
|
|
body:
|
|
declare num1:int = 1
|
|
loop:
|
|
init:
|
|
declare counter:int = 1
|
|
cond:
|
|
counter <= n
|
|
step:
|
|
counter = counter + 1
|
|
body:
|
|
num1 = num1 * counter
|
|
end body
|
|
end loop
|
|
return num1
|
|
end body
|
|
end function
|
|
end module
|