mirror of
https://github.com/ziglang/zig.git
synced 2024-11-14 16:13:24 +00:00
13 lines
247 B
Zig
13 lines
247 B
Zig
const assert = @import("std").debug.assert;
|
|
|
|
fn fibonacci(index: i32) i32 {
|
|
//if (index < 2) return index;
|
|
return fibonacci(index - 1) + fibonacci(index - 2);
|
|
}
|
|
|
|
test "fibonacci" {
|
|
try comptime assert(fibonacci(7) == 13);
|
|
}
|
|
|
|
// syntax
|