Swift-Switch穿透

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判断语句要符合规则

上一篇:Task schedule 分类: 比赛 HDU 查找 2015-08-08 16:00 2人阅读 评论(0) 收藏


下一篇:ORA-1653: unable to extend table SYS.AUD$