1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
module a::m { struct S has copy { x: u64, y: u64, } fun f(o: S): u64 { let total = 0; if (o.x > 0) { total = o.x; } else { total = o.y; } while (total > 0) { total = total - 1; } total } fun classify(n: u64): u64 { match (n) { 0 => 1, _ => 0, } } }