aboutsummaryrefslogtreecommitdiff
path: root/examples/fib.fco
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2024-04-19 20:21:56 +0100
committerJuan J. Martinez <jjm@usebox.net>2024-04-19 20:25:26 +0100
commit044360219f2e4e0b5b5a95cb7ede00753340d61d (patch)
tree4c2341a6e4941b3c3b70ca9941699e8f84353901 /examples/fib.fco
downloadfunco-044360219f2e4e0b5b5a95cb7ede00753340d61d.tar.gz
funco-044360219f2e4e0b5b5a95cb7ede00753340d61d.zip
Initial import
Diffstat (limited to 'examples/fib.fco')
-rw-r--r--examples/fib.fco13
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/fib.fco b/examples/fib.fco
new file mode 100644
index 0000000..d459341
--- /dev/null
+++ b/examples/fib.fco
@@ -0,0 +1,13 @@
+# fibonacci number
+def fib(n)
+ if <(n 2)
+ n
+ else
+ +(fib(- (n 1)) fib(- (n 2)))
+ end
+end
+
+def main()
+ display("Running fib(20)...")
+ display(fib(20))
+end