code:switch(string){ case "test1": // equivalent of if(string == "test1") break; case "test2": // code.. break; }