mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 15:42:49 +00:00
17 lines
234 B
Zig
17 lines
234 B
Zig
const MyEnum = enum { One, Two, Three };
|
|
|
|
pub fn main() u8 {
|
|
var val: MyEnum = .Two;
|
|
_ = &val;
|
|
const a: u8 = switch (val) {
|
|
.One => 1,
|
|
.Two => 2,
|
|
.Three => 3,
|
|
};
|
|
|
|
return a - 2;
|
|
}
|
|
|
|
// run
|
|
//
|