Replace switch-case with if statement