break for all loop code example
Example 1: does break stop all loops
Using break in a nested loop
In a nested loop, a break statement only stops the loop it is placed in.
Therefore, if a break is placed in the inner loop, the outer loop still
continues. However, if the break is placed in the outer loop, all of the
looping stops.
Example 2: break all loops
break only stops the loop it is in.
if you want to break out of a while true loop try:
flag = True
while flag:
for i in range(1000):
if i == 10:
flag = False
break