Demo changes
This commit is contained in:
@@ -40,4 +40,4 @@ let map = fn(arr, f) {
|
||||
};
|
||||
|
||||
let numbers = [1, 1 + 1, 4 - 1, 2 * 2, 2 + 3, 12 / 2];
|
||||
map(numbers, fibonacci);
|
||||
//map(numbers, fibonacci);
|
||||
8
examples/fact.monkey
Normal file
8
examples/fact.monkey
Normal file
@@ -0,0 +1,8 @@
|
||||
let fact = fn(n) {
|
||||
if (n == 0) {
|
||||
return 1
|
||||
}
|
||||
return n * fact(n - 1)
|
||||
}
|
||||
|
||||
print(fact(5)
|
||||
8
examples/factt.monkey
Normal file
8
examples/factt.monkey
Normal file
@@ -0,0 +1,8 @@
|
||||
let fact = fn(n, a) {
|
||||
if (n == 0) {
|
||||
return a
|
||||
}
|
||||
return fact(n - 1, a * n)
|
||||
}
|
||||
|
||||
print(fact(5, 1))
|
||||
1
examples/hello.monkey
Normal file
1
examples/hello.monkey
Normal file
@@ -0,0 +1 @@
|
||||
print("Hello World!")
|
||||
Reference in New Issue
Block a user