I think this would be easier to read as a set of if-else conditions. You also need a terminal else to catch any unexpected input types.