about summary refs log tree commit diff
path: root/examples/8.src
blob: 671640bce19555ad8fcea4ffcb447afa421a45a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import "!stdlib.src";

let main = () => i64 {
	let fib = (n: i64) => i64 {
		if n == 0 {
			return 0;
		};
		if n == 1 {
			return 1;
		};
		return fib(n-2) + fib(n-1);
	};

	let result = fib(30);
	printf("%d\n", result);
	return result;
};

/*

Expected stdout:

832040

Expected return: 832040

*/