The if statement break is nested in the while loop, which statement should be jumped out?

Today, I want to confirm whether break is related to if, is it jumping out of if judgment?
Nonono, break can only jump out of the nearest for loop and while loop, and has nothing to do with if:

i=0
while i<100:
    if i<9:
        print(0)
    else:
        break
    i=i+1
print(i)
0
0
0
0
0
0
0
0
0
9

Guess you like

Origin blog.csdn.net/qq_43511299/article/details/114544417