Swift 在循環中的控制語句含代碼

Swift 在循環中的控制語句

控制語句在循環中使用,用于改變執行順序。愛掏網 - it200.com當執行離開作用域時,自動創建的所有對象都會被銷毀。愛掏網 - it200.com

Swift 4支持的控制語句列表:

Swift 4中的 continue 語句用于停止當前正在執行的語句,并從下一次循環迭代的開始處重新開始。愛掏網 - it200.comcontinue語句可配合for循環、while循環和do…while循環使用。愛掏網 - it200.com

對于 for 循環,continue語句檢查條件并增加循環的部分以執行。愛掏網 - it200.com

對于 while和do…while 循環,continue語句將程序控制傳遞給條件測試。愛掏網 - it200.com

語法

Swift 4循環中continue語句的語法如下:

continue 

Swift 4的continue語句的流程圖

示例

var index = 10

repeat {
   index = index + 1
   if( index == 25 ){
      continue
   }
   print( "Value of index is \(index)")
} while index < 30

輸出:

Value of index is 11
Value of index is 12
Value of index is 13
Value of index is 14
Value of index is 15
Value of index is 16
Value of index is 17
Value of index is 18
Value of index is 19
Value of index is 20
Value of index is 21
Value of index is 22
Value of index is 23
Value of index is 24
Value of index is 25
Value of index is 26
Value of index is 27
Value of index is 28
Value of index is 29
Value of index is 30

聲明:所有內容來自互聯網搜索結果,不保證100%準確性,僅供參考。如若本站內容侵犯了原著者的合法權益,可聯系我們進行處理。
發表評論
更多 網友評論0 條評論)
暫無評論

返回頂部

主站蜘蛛池模板: 亚洲一区二区久久| 性欧美vr高清极品| 国产夫妻在线观看| 久久久久无码中| 翘臀少妇被扒开屁股日出水爆乳| 我要看a级毛片| 免费国产成人手机在线观看 | 亚洲精品电影网| 中国美团外卖男男china| 香蕉视频免费看| 成人免费看www网址入口| 人人妻人人澡人人爽人人精品浪潮| 91丨九色丨首页在线观看| 曰批免费视频播放30分钟直播 | 国产精品高清一区二区三区| 亚洲人成在线播放网站| 青苹果乐园影视免费观看电视剧hd| 成人在线免费观看网站| 亚洲美国产亚洲av| 成人禁在线观看| 欧美亚洲国产日韩| 国产乱色在线观看| www.九色视频| 最近的2019中文字幕hd| 四虎在线最新永久免费| 99热国产免费| 日韩在线播放全免费| 免费羞羞视频网站| 日产精品一二三四区国产| 成在线人视频免费视频| 亚洲欧美一区二区三区| 进击的巨人第一季动漫樱花动漫 | 久久久久久亚洲av无码专区| 神乃麻美三点尽露写真| 国产精品一区12p| 中文在线天堂网www| 欧美日韩一区视频| 四虎永久免费地址ww484e5566 | 欧美黑人5o厘米全进去| 国产交换丝雨巅峰| 99精品众筹模特自拍视频|