type State { Active = "启用", Closed = "关闭" } type Item { name: Text, price: Decimal >= 0, quantity: Int >= 1, state: State, note: Text? } bill(input: Item) (total: Decimal, item: Item) { total = input.price * input.quantity item = input } guarded(value: Int) (out: Int) { check value > 0 else Invalid out = value } overflow(value: Int) (out: Int) { out = value + 1 } nonfinite(value: Float) (out: Float) { out = value / 0.0 } cmd bill = bill cmd guarded = guarded cmd overflow = overflow cmd nonfinite = nonfinite