Please someone explain me break and continue in loops in easy words. A bit confused | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please someone explain me break and continue in loops in easy words. A bit confused

Confused

19th Feb 2017, 11:22 AM
Legend Shees
Legend Shees - avatar
5 Answers
0
break keyword will break all loops and will came out from loops and continue keyword use to jump certain loop and continue others, in break it will terminate all further loops.
19th Feb 2017, 11:52 AM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
0
I'm understanding it a little, I have a request that can u please type down a code to make it more clear
19th Feb 2017, 1:26 PM
Legend Shees
Legend Shees - avatar
0
I've completely understood break, just explain continue, thankful for your help :)
19th Feb 2017, 1:28 PM
Legend Shees
Legend Shees - avatar
0
https://code.sololearn.com/ccW8zlbk2X0Y/?ref=app here I wrote simple program to print sum of even numbers.
19th Feb 2017, 2:01 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
0
To put it simply, if a break condition is met, the loop will terminate and the next line after the loop will execute. If a continue condition is met, no further statements in the loop will execute, the counter will increment and the loop will continue.
23rd Feb 2017, 1:03 AM
Jason Johnston