I have the following code snippet.
1 for k in range(m):
2
3 # step 1
4 step_1() # this is a function that updates some values
5
6 # step 2
7 if len(R) == 0:
8 print("R is empty - construction completed!")
9 break
10 elif len(R) == 1:
11 if f[i] <= b[k]:
12 # do something and terminate the program
13 break
14 else:
15 # do something and go back to step 1
16 continue
17 else:
18 # function that assings some values to i and j
19 i,j = select_two_closest_nodes()
20
21 if f[i] > b[k] and f[j] <= b[k]:
22 # step 2a
23 if b[k]-f[j] <= A:
24 # do something and go back to step 1
25 continue
26 else:
27 # do something and go back to step 2
If I want to go from row 15 back to step 1 I can just add continue at the end of the else block, as k then enters the next iteration and step_1() runs again. Same thing if I want to go from row 24 to step 1. However, If I'm at 27 and want to skip step 1 altogether and go straight to step 2 without running step_1() I can't just add a continue. How can I go from row 27 to row 6? I.e without entering the next iteration in the for loop.