Bob/test_fib.bob
Bobby Lucero 72a1b82b43 More things
- Add while, for, and do-while loops with break/continue
- Implement assignment statements (prevents if(x=10) bugs)
- Keep assignment expressions only for for-loop clauses
- Fix critical memory management bug (dangling pointers in cleanup)
- Add automatic memory cleanup with conservative reference counting
- Consolidate documentation into single reference file
- Add comprehensive test coverage for all loop types and edge cases
- VSCode extension for bob highlighting and snippets
2025-08-06 00:57:36 -04:00

21 lines
305 B
Plaintext

var counter = 0;
func fib(n) {
if (n <= 1) {
return n;
}
counter++; // Only increment for recursive calls
return fib(n - 1) + fib(n - 2);
}
print("Fibonacci test:");
var fib_result = fib(30);
print("Result: " + fib_result);
print("Counter: " + counter);
func test_fib() {
}