switch vegetable { case "celery": print("Add some raisins and make ants on a log.") case "cucumber", "watercress": print("That would make a good tea sandwich.") case let x where x.hasSuffix("pepper"): print("Is it a spicy \(x)?") fallthrough case "red pepper": print("你妹啊") default: print("Everything tastes good in soup.") } fallthrough所在的case中fallthrough后面的语句不在执行,直接执行下一个case,且下一个case判断语句要符合规则
|
请发表评论