migrate if to switch

migrate if to switch