summaryrefslogtreecommitdiffstats
path: root/src/examples/recursive.ft
blob: d6f7a697d54664fa76eb01eae5c47e32c9724103 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
program recursive
int::value
int::final
value=5
final=factorial(value)
print*,"The factorial of ",value," is ",final
end program recursive

function int factorial(int x)
if x==1 then
return 1
end if 
return x*factorial(x-1)
end