Covert if to switch