New course! Every coder should learn Generative AI!
Try a free lesson0
Can anyone explain , how a continue statement works and what is break , what is the relation btw this two.
I'm confused
2 Answers
+ 5
Akhil Nair
>TheĀ breakĀ statement allows you to leave aĀ forĀ orĀ whileĀ loop prematurely.
>TheĀ continueĀ statement ignores the rest of the statements inside a loop, and continues with the next iteration.Ā
+ 3
*Break* statement breaks the loop(i.e. control goes outside the loop) whereas, whenever *continue* is encountered system skips that iteration and continues execution of other statements.
see this code for more understandingš
https://code.sololearn.com/c5imZISk9vV0/?ref=app