53b43b0f79
Ship the QUALITY_PLAN stretch from ownership through ecosystem: C.1 lifetime elision (bootstrap + selfhost), bux fmt/test/doc CI hooks, stdlib goldens, package registry (bux search/add), and LSP 0.4 position-sensitive locals with inferred let types. Full-tree format pass plus Map/Set remove double-free fix.
24 lines
467 B
Plaintext
24 lines
467 B
Plaintext
// Fibonacci - Recursive function with while loop
|
|
import Std::Io::{PrintLine};
|
|
import Std::Fmt::{Fmt_Fmt1};
|
|
|
|
func Fibonacci(n: int) -> int {
|
|
if n <= 1 {
|
|
return n;
|
|
}
|
|
return Fibonacci(n - 1) + Fibonacci(n - 2);
|
|
}
|
|
|
|
func Main() -> int {
|
|
PrintLine("Fibonacci sequence:");
|
|
|
|
var i: int = 0;
|
|
while i < 10 {
|
|
let fib: int = Fibonacci(i);
|
|
PrintLine(Fmt_Fmt1("{0}", String_FromInt(fib)));
|
|
i = i + 1;
|
|
}
|
|
|
|
return 0;
|
|
}
|