mirror of
https://github.com/ziglang/zig.git
synced 2024-11-30 09:02:32 +00:00
parent
c647799e5e
commit
2cc9c99ebf
@ -151,3 +151,15 @@ test "result location with inferred type ends up being pointer to comptime_int"
|
||||
} else @as(u32, 0);
|
||||
try expect(c == 1);
|
||||
}
|
||||
|
||||
test "if-@as-if chain" {
|
||||
var fast = true;
|
||||
var very_fast = false;
|
||||
|
||||
const num_frames = if (fast)
|
||||
@as(u32, if (very_fast) 16 else 4)
|
||||
else
|
||||
1;
|
||||
|
||||
try expect(num_frames == 4);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user