aboutsummaryrefslogtreecommitdiff
path: root/examples/fib.sil
blob: 4a218ed0201a28a08b127d6cabab0e82f2019523 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/**
 * The Fibonacci function
 */
Int fib(Int n) {
	// Base cases
	if (n == 1) {
		return 1;
	} else if (n == 2) {
		return 1;
	// Recursive case
	} else {
		return fib(n - 1) + fib(n - 2);
	}
}

Int main() {
	return fib(10);
}