some comptime thing

main
Jordan Orelli 4 years ago
parent d8ea7fbd70
commit 23b477b747

@ -0,0 +1,12 @@
const std = @import("std");
const assert = std.debug.assert;
fn fibonacci(x: u32) u32 {
if (x <= 1) return x;
return fibonacci(x - 1) + fibonacci(x - 2);
}
test "compile-time evaluation" {
var array: [fibonacci(6)]i32 = undefined;
assert(array.len == 8);
}
Loading…
Cancel
Save