+ 1

What is the difference between break and continue?

30th Mar 2020, 12:04 AM
Bhatesh Khairnar
Bhatesh Khairnar - avatar
3 Réponses
+ 2
The break keyword is used to breaks(stopping) a loop execution, which may be a for loop, while loop, do while or for each loop. The continue keyword is used to skip the particular recursion only in a loop execution, which may be a for loop, while loop, do while or for each loop.
30th Mar 2020, 12:14 AM
Kashyap Kumar
Kashyap Kumar - avatar
+ 1
A break will stop iterating through the loop and move on, continue on the other hand is used to move to the next item in the loop.
30th Mar 2020, 1:02 AM
Jose Ayala
Jose Ayala - avatar
+ 1
BREAK :- It is a keyword is used to break a loop execution, which may be any loop (for loop, while loop and do while loop). CONTINUE :- It is also a keyword which is used to skip the particular iteration in a loop execution, which may be any loop (for loop, while loop and do while loop).
10th Apr 2020, 4:34 AM
Sunil Yadav
Sunil Yadav - avatar