diff options
author | Manuel Palenzuela Merino <manuel.palenzuela@datadoghq.com> | 2025-01-18 20:29:40 +0100 |
---|---|---|
committer | Manuel Palenzuela Merino <manuel.palenzuela@datadoghq.com> | 2025-01-18 20:29:40 +0100 |
commit | 45b047db40e2c60c1373219508632baf823e9638 (patch) | |
tree | 01235b1aa9861dfab1e83e2b2ee267c467712e4f | |
parent | Evaluator: implement support for function arguments (diff) | |
download | interpreter-45b047db40e2c60c1373219508632baf823e9638.tar.gz interpreter-45b047db40e2c60c1373219508632baf823e9638.tar.bz2 interpreter-45b047db40e2c60c1373219508632baf823e9638.zip |
Examples: add future examples :^)
-rw-r--r-- | examples/7.src | 10 | ||||
-rw-r--r-- | examples/8.src | 15 |
2 files changed, 25 insertions, 0 deletions
diff --git a/examples/7.src b/examples/7.src new file mode 100644 index 0000000..36796cb --- /dev/null +++ b/examples/7.src @@ -0,0 +1,10 @@ +let main = () => { + let i = 4; + + if i == 4 { + print(i); + return i; + } + + return 1; +}; 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; +}; |