summaryrefslogtreecommitdiff
path: root/sample/fib.awk
diff options
context:
space:
mode:
Diffstat (limited to 'sample/fib.awk')
-rw-r--r--sample/fib.awk5
1 files changed, 5 insertions, 0 deletions
diff --git a/sample/fib.awk b/sample/fib.awk
new file mode 100644
index 0000000..7ebe893
--- /dev/null
+++ b/sample/fib.awk
@@ -0,0 +1,5 @@
+ function fib(n) {
+ if ( n<2 ) return n; else return fib(n-2) + fib(n-1)
+ }
+
+ BEGIN { print fib(20); }