zig/test/cases/switch.3.zig

16 lines
218 B
Zig
Raw Normal View History

2022-04-27 21:59:55 +01:00
const MyEnum = enum { One, Two, Three };
pub fn main() u8 {
var val: MyEnum = .Two;
var a: u8 = switch (val) {
.One => 1,
.Two => 2,
.Three => 3,
};
return a - 2;
}
// run
//