码迷,mamicode.com
首页 > 其他好文 > 详细

跳转语句

时间:2015-10-28 15:53:04      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:

1.continue

作用:中止当次循环

for var i = 0;i<100;i++{

    if i%10 ==0 {

        continue

    }

}


2.break

作用:中止循环


3.fallthrough

作用:让switch继续走下去,不中止

        var description = "xx"
        let integerToDescibe = 5
       
       switch integerToDescibe {
        case 2,3,5:
            description += "AA"
            fallthrough
        default:
            description += "bb"
        }
        print(description)
        
    }


4.return

作用:用在函数内部,中止

跳转语句

标签:

原文地址:http://my.oschina.net/u/2346786/blog/523106

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!