does break stop all loops

Solutions on MaxInterview for does break stop all loops by the best coders in the world

showing results for - "does break stop all loops"
Frieda
07 Sep 2018
1Using break in a nested loop
2
3In a nested loop, a break statement only stops the loop it is placed in.
4Therefore, if a break is placed in the inner loop, the outer loop still
5continues. However, if the break is placed in the outer loop, all of the 
6looping stops.
7
8
Silvia
13 Jan 2018
1break only stops the loop it is in.
2if you want to break out of a while true loop try:
3flag = True
4while flag:
5	for i in range(1000):
6    	if i == 10:
7        	flag = False
8            break
9