summaryrefslogtreecommitdiff
path: root/test/fib.myr
diff options
context:
space:
mode:
authorOri Bernstein <orib@google.com>2012-06-05 19:49:19 -0400
committerOri Bernstein <orib@google.com>2012-06-05 19:49:19 -0400
commit48f0c839b6ce7bec4537e48271bcbe6def469a0c (patch)
tree205329273efbd6292e9ab90ccd742dcb62544c6f /test/fib.myr
parentc849754267a367a08b373d67b06439576b87c308 (diff)
downloadmc-48f0c839b6ce7bec4537e48271bcbe6def469a0c.tar.gz
Add fibonacci sequence test.
Tests function calls, recursion, and arithmetic.
Diffstat (limited to 'test/fib.myr')
-rw-r--r--test/fib.myr14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/fib.myr b/test/fib.myr
new file mode 100644
index 0000000..6eb4b44
--- /dev/null
+++ b/test/fib.myr
@@ -0,0 +1,14 @@
+const fib = {n
+ if n == 0
+ -> 0
+ elif n == 1
+ -> 1
+ else
+ -> fib(n - 1) + fib(n - 2)
+ ;;
+}
+
+const main = {
+ -> fib(4)
+}
+