Swift 循环的 标签

2017-07-13  本文已影响3人  json_jie
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

上一篇 下一篇

猜你喜欢

热点阅读