Computer Science
How is break statement different from continue?
Python Control Flow
9 Likes
Answer
When the break statement gets executed, it terminates its loop completely and control reaches to the statement immediately following the loop. The continue statement terminates only the current iteration of the loop by skipping rest of the statements in the body of the loop.
Answered By
6 Likes
Related Questions
How and when are named conditions useful?
What are endless loops ? Why do such loops occur?
Rewrite the following code fragment that saves on the number of comparisons:
if (a == 0) : print ("Zero") if (a == 1) : print ("One") if (a == 2) : print ("Two") if (a == 3) : print ("Three")
Under what conditions will this code fragment print "water"?
if temp < 32 : print ("ice") elif temp < 212: print ("water") else : print ("steam")