Complete the code to break out of the outer loop using the label.
outerLoop: for i in 1...3 { for j in 1...3 { if i == 2 && j == 2 { [1] } print("i = \(i), j = \(j)") } }
Using break outerLoop exits the outer loop immediately when the condition is met.
Complete the code to continue the outer loop when the inner loop reaches j == 2.
outer: for i in 1...3 { for j in 1...3 { if j == 2 { [1] } print("i = \(i), j = \(j)") } }
continue outer skips the rest of the current iteration of the outer loop and moves to the next iteration.
Fix the error in the code to correctly break out of the outer loop.
outerLoop: for x in 1...3 { for y in 1...3 { if x == 3 && y == 1 { [1] } print("x = \(x), y = \(y)") } }
The label name is case-sensitive. It must match exactly as outerLoop.
Fill the blank to continue the outer loop and skip the current inner loop iteration when j == 3.
outerLoop: for i in 1...3 { for j in 1...3 { if j == 3 { [1] } print("i = \(i), j = \(j)") } }
continue outerLoop skips the rest of the current iteration of the outer loop when j == 3.
Fill all three blanks to break out of the outer loop when i == 2 and j == 3, and print a message after the loops.
outer: for i in 1...3 { for j in 1...3 { if i == [1] && j == [2] { [3] } print("i = \(i), j = \(j)") } } print("Exited loops")
The code breaks out of the outer loop when i is 2 and j is 3 using break outer.