Can anyone explain , how a continue statement works and what is break , what is the relation btw this two. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone explain , how a continue statement works and what is break , what is the relation btw this two.

I'm confused

27th Jun 2020, 8:32 AM
Akhil
Akhil - avatar
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.Ā 
27th Jun 2020, 8:39 AM
Indira
Indira - avatar
+ 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
27th Jun 2020, 8:38 AM
Arsenic
Arsenic - avatar