zig/test/cases/enum_values.0.zig

19 lines
317 B
Zig
Raw Normal View History

2022-04-27 21:59:55 +01:00
const Number = enum { One, Two, Three };
pub fn main() void {
var number1 = Number.One;
var number2: Number = .Two;
if (false) {
number1;
number2;
}
const number3 = @enumFromInt(Number, 2);
if (@intFromEnum(number3) != 2) {
2022-04-27 21:59:55 +01:00
unreachable;
}
return;
}
// run
//