convert if else to switch statement