Skip to content

Commit 6f563d1

Browse files
committedDec 9, 2020
[add] a recursion example.
1 parent 07be55a commit 6f563d1

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed
 

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ This language is still currently experimental with many more features to come.
2121
* Conditionals.
2222
* Loops.
2323
* Closures.
24+
* [Recursion](examples/recursion.ls).
2425
* Blocks.
2526
* Printing.
2627
* Lambda expressions/Anonymous functions.

‎examples/fib.ls renamed to ‎examples/recursion.ls

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Typical function declaration that solves for fib of n
12
func fib(n) {
23
if (n <= 1) {
34
return n;
@@ -6,4 +7,5 @@ func fib(n) {
67
return fib(n - 2) + fib(n - 1);
78
}
89

10+
// Starts parsing fib of 10.
911
print fib(10);

0 commit comments

Comments
 (0)
Please sign in to comment.