6.6 Break Flashcards
1
Q
What is nested control statement?
A
When we use multiple control flow tools it is called nested control statement.
2
Q
When is the break keyword used?
A
When we want to exit the loop when a certain condition is met
3
Q
Write a syntax using break loop
A
j=0 for i in range (5): j=j+2 print('i=',i,'j=',j) if j ==6: break
The answer is
i= 0 j= 2
i= 1 j= 4
i= 2 j= 6
It stops executing when the answer reaches 6 as the value for J