How to break outer loops from inner structures that respond break (loops/switch)

前端 未结 2 1188
逝去的感伤
逝去的感伤 2020-12-13 05:36

How to I break an outer loop from within an nested structure that responds to the break statement in Swift?

For example:

while someCondi         


        
2条回答
  •  不知归路
    2020-12-13 06:17

    Label the loop as outerLoop and whenever needed user break Label: i.e. break outerLoop in our case.

    outerLoop: for indexValue in 0.. arr[indexValue+1] {
                    break outerLoop
                } 
            } 
    

提交回复
热议问题