mirror of
https://github.com/ziglang/zig.git
synced 2024-11-30 09:02:32 +00:00
29 lines
405 B
Zig
29 lines
405 B
Zig
|
fn params() {
|
||
|
@setFnTest(this);
|
||
|
|
||
|
assert(testParamsAdd(22, 11) == 33);
|
||
|
}
|
||
|
fn testParamsAdd(a: i32, b: i32) -> i32 {
|
||
|
a + b
|
||
|
}
|
||
|
|
||
|
|
||
|
fn localVariables() {
|
||
|
@setFnTest(this);
|
||
|
|
||
|
testLocVars(2);
|
||
|
}
|
||
|
fn testLocVars(b: i32) {
|
||
|
const a: i32 = 1;
|
||
|
if (a + b != 3) @unreachable();
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
// TODO const assert = @import("std").debug.assert;
|
||
|
fn assert(ok: bool) {
|
||
|
if (!ok)
|
||
|
@unreachable();
|
||
|
}
|