about summary refs log tree commit diff
path: root/examples/8.src
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2025-01-18 20:29:40 +0100
committerBaitinq <[email protected]>2025-01-18 20:29:40 +0100
commit092a8eac98dcc6f1a79f1e8d55ea64a7c09377da (patch)
tree01235b1aa9861dfab1e83e2b2ee267c467712e4f /examples/8.src
parentEvaluator: implement support for function arguments (diff)
downloadinterpreter-092a8eac98dcc6f1a79f1e8d55ea64a7c09377da.tar.gz
interpreter-092a8eac98dcc6f1a79f1e8d55ea64a7c09377da.tar.bz2
interpreter-092a8eac98dcc6f1a79f1e8d55ea64a7c09377da.zip
Examples: add future examples :^)
Diffstat (limited to 'examples/8.src')
-rw-r--r--examples/8.src15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/8.src b/examples/8.src
new file mode 100644
index 0000000..75b5c56
--- /dev/null
+++ b/examples/8.src
@@ -0,0 +1,15 @@
+let fib = (n) => {
+	if n == 0 {
+		return 0;
+	}
+	if n == 1 {
+		return 1;
+	}
+	return fib(n-2) + fib(n-1);
+};
+
+let main = () => {
+	let result = fib(7);
+	print(result);
+	return result;
+};