美文网首页
Swift 循环的 标签

Swift 循环的 标签

作者: json_jie | 来源:发表于2017-07-13 16:50 被阅读3次
outerloop:
for  i in 0 ..< 10
{
  innerloop:
    
    for j in 0 ..< 10
{
    if (j > 3)
    {
        break;
    }
    if (i == 2)
    {
        break innerloop;
    }
    if (i == 4)
    {
        break outerloop;
    }
    print("i = \(i)  and with j = \(j)"  )
}
}

i = 0 and with j = 0
i = 0 and with j = 1
i = 0 and with j = 2
i = 0 and with j = 3
i = 1 and with j = 0
i = 1 and with j = 1
i = 1 and with j = 2
i = 1 and with j = 3
i = 3 and with j = 0
i = 3 and with j = 1
i = 3 and with j = 2
i = 3 and with j = 3

相关文章

网友评论

      本文标题:Swift 循环的 标签

      本文链接:https://www.haomeiwen.com/subject/jvtghxtx.html