What's the difference between writing "continue" and not writing anything? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

What's the difference between writing "continue" and not writing anything?

13th Mar 2016, 9:24 AM
Taner
Taner - avatar
5 Answers
+ 2
with "continue" you stop current loop iteration and go to the start of the loop
21st Mar 2016, 10:40 PM
Jakub Walawski
0
Writing Continue is similar to Break. Notice how Break stops a loop, and then goes onto what is next in the code? Continue breaks a loop and starts outputting the code from the start with the changes already implemented, such as a+= 1 gone through twice, and then the continue breaks the possibility of the loop being repeated again. Not writing anything, the loop would just continue on for "Infinity" in a happy little Theoretical World, but through Experiment it ends through either the system crashing, the loop being broken by the program being closed, or similar.
13th Apr 2016, 3:21 PM
Zac Hinote
Zac Hinote - avatar
0
for example i =5; while(i!=0) { i--; print"Hello"; } This program will print the word until value of becomes 0. same program with continue i =5; while(i!=0) { i--; continue; print"Hello"; } this program will check whether i!=0 ,if true it will decrement i by 1 and then go to the condition in while loop without printing Hello
22nd Jun 2016, 4:08 PM
Hemant Gosavi
Hemant Gosavi - avatar
0
while loop run till condition is satisfy if we want the program to be continuously so we use continue to start the program from starting . I hope u would understand it
6th Jul 2016, 10:49 AM
rishu
0
If you use continue anything after continue inside the loop will not be executed and the loop will simply go to the next iteration. The absence of continue just imply 's that that for every iteration everything under the loop will be executed. Hope this helps:)
8th Jul 2016, 12:34 PM
Athreyan MKS
Athreyan MKS - avatar