RosettaCodeData/Task/Conditional-structures/E/conditional-structures-4.e
2023-07-01 13:44:08 -04:00

7 lines
191 B
Text

def expression := ["+", [1, 2]]
def value := switch (expression) {
match [`+`, [a, b]] { a + b }
match [`*`, [a, b]] { a * b }
match [op, _] { throw(`unknown operator: $op`) }
}