summaryrefslogtreecommitdiffstats
path: root/src/examples
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/recursive.ft14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/examples/recursive.ft b/src/examples/recursive.ft
new file mode 100644
index 0000000..d6f7a69
--- /dev/null
+++ b/src/examples/recursive.ft
@@ -0,0 +1,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 \ No newline at end of file