1. func eval(a, b int, op string) int {
    2. var result int
    3. switch op {
    4. case "+":
    5. result = a + b
    6. case "-":
    7. result = a - b
    8. case "*":
    9. result = a * b
    10. case "/":
    11. result = a / b
    12. default:
    13. panic("unsupported operator:" + op)
    14. }
    15. return result
    16. }