使用高级方法使代码更干燥

Is there any way for me to make this switch statement less verbose. I am yielding the correct result but I feel I am repeating myself too much. ![Photo of switch statement[1]][1]

评论