fallthrough

来源:互联网 发布:天津总医院挂号软件 编辑:程序博客网 时间:2024/06/16 02:11

源代码:

////  fallthrough.swift////  Created by chenzhen on 16/7/31.//  From 大连东软信息学院//  Copyright © 2016年 zhen7216. All rights reserved.//import Foundationvar j = 1var x = 2switch x {case 1:    j += 1case 2:    j += 1    fallthroughcase 3:    j += 1    fallthroughdefault:    j += 1}print("j = \(j)")

运行结果:


0 0