Files
doslang-mirror/fec/tests/m3/enum.fe
T

17 lines
370 B
Plaintext

unit m3_enum;
enum Shape { Empty, Circle(i32), Rect { w: i32, h: i32, }, }
fn score(s: Shape) -> i32 {
match s {
Empty => { return 0; }
Circle(value) => { return value; }
Rect { w, h } => { return w * h; }
}
}
fn main() -> i32 {
if score(Shape.Circle(5)) == 5 and score(Shape.Rect{ w: 2, h: 3 }) == 6 { return 0; }
return 1;
}