New course! Every coder should learn Generative AI!
Try a free lesson+ 2
In the below code , break statement is inside the if loop but while loop get terminated.why?
2 Answers
+ 3
The "if" is not a loop.
+ 1
The ''break'' statement terminates the closest enclosing loop. ''if'' is not a loop it is a ''statement". A loop repeatedly executes the statements enclose within it as long as the loop condition is 'True'. Whereas, a statement executes only once.