mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 15:42:49 +00:00
50339f595a
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
24 lines
347 B
Zig
24 lines
347 B
Zig
extern "c" fn write(c_int, usize, usize) usize;
|
|
|
|
pub fn main() void {
|
|
var i: u32 = 0;
|
|
while (i < 4) : (i += 1) print();
|
|
assert(i == 4);
|
|
}
|
|
|
|
fn print() void {
|
|
_ = write(1, @intFromPtr("hello\n"), 6);
|
|
}
|
|
|
|
pub fn assert(ok: bool) void {
|
|
if (!ok) unreachable; // assertion failure
|
|
}
|
|
|
|
// run
|
|
//
|
|
// hello
|
|
// hello
|
|
// hello
|
|
// hello
|
|
//
|