Overview
The following snippet below should produce the value 3 but instead produces the value 1
// Recursively calculates the fibonacci sequence
fn fibonacci(n: number) {
@dump_stack();
if (n <= 1) {
return n;
}
return fibonacci(n - 1) + fibonacci(n - 2);
}
@println(fibonacci(4));
I suspect this is a result of how we handle return values relative to our frame pointer but more investigation is needed.