if statement replaced wit switch-case