循环中的控制语句17 Mar 2025 | 阅读 2 分钟 控制语句用于循环中以改变其正常顺序的执行。 当执行离开作用域时,在该作用域中自动创建的所有已创建的对象都将被销毁。 Swift 4 中支持的控制语句列表 Continue 语句Swift 4 continue 语句用于停止当前正在执行的语句,并从循环的下一次迭代开始。 continue 语句与 for 循环、while 循环和 do...while 循环一起使用。 对于 'for' 循环,continue 语句测试条件并递增循环的部分以执行。 对于 'while' 和 'do...while' 循环,continue 语句将程序控制传递给条件测试。 语法Swift 4 循环中 continue 语句的语法如下 Swift 4 Continue 语句的流程图 ![]() 示例输出 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 下一主题Fallthrough 语句 |
我们请求您订阅我们的新闻通讯以获取最新更新。