2023-04-19 14:17:48 +01:00
|
|
|
extern "c" fn write(c_int, usize, usize) usize;
|
2022-04-28 10:42:14 +01:00
|
|
|
|
|
|
|
pub fn main() void {
|
|
|
|
var i: u32 = 0;
|
|
|
|
inline while (i < 4) : (i += 1) print();
|
|
|
|
assert(i == 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn print() void {
|
2023-06-15 08:14:16 +01:00
|
|
|
_ = write(1, @intFromPtr("hello\n"), 6);
|
2022-04-28 10:42:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn assert(ok: bool) void {
|
|
|
|
if (!ok) unreachable; // assertion failure
|
|
|
|
}
|
|
|
|
|
|
|
|
// error
|
|
|
|
//
|
|
|
|
// :5:21: error: unable to resolve comptime value
|
2022-10-05 19:58:23 +01:00
|
|
|
// :5:21: note: condition in comptime branch must be comptime-known
|