switch(string) -> if, code reformating