Interviews14 answers
What happens when you encounter a continue statement inside the for loop?
14 Answers
it will skip the execution of the current statements and moves to the loop for next iteration
Srinivas PabballaPosted Aug 28, 2015, 1:16 AM EDT
From the continue statement all the lines of code won't get executed for that specific iteration.
Loop continuing to next iteration.
for(i=1;i<=10;i++)
{
//My All lines of code executes for all iteration
if(i==5)
continue;
//Below line of code wont executed when i==5
print(i);
}
for more details
https://msdn.microsoft.com/en-us/library/923ahwt1.aspx
Ajay GandhiPosted Aug 25, 2015, 3:49 AM EDT
skipping the value and continues the loop.
Sreekanth ReddyPosted Jul 10, 2015, 10:33 PM EDT
It will skip all the statements after the continue statement and go for the next iteration.
Rahul PrajapatPosted May 31, 2015, 7:34 PM EDT
The loop does not execute the specific value
Safayat ZisanPosted Apr 17, 2015, 1:03 PM EDT
If you use the continue statement in any loop then it will skip the implementation of
remaining step and execution of program jump to the starting of loop.......
Pankaj Kumar ChoudharyPosted Mar 23, 2015, 7:34 PM EDT
Dear
If you use continue in for loop it will skip the that value , If you use break it will not give any output for that ...
for(var i=0;i<=10;i++)
{
if(i==5)
continue;
if(i==6)
break;
console.writeline(i);
}
//For Continue output : 1234678910
//For break output : 1234
Sandeep MiriyalaPosted Dec 9, 2014, 2:54 AM EST
for(i=1;i<=10;i++)
{
if(i==5)
continue;
print(i);
}
O/P
1234678910
Vikram AgrawalPosted Dec 8, 2014, 1:57 AM EST
It will skip all the statements after the continue statement and go for the next iteration.
Vikram AgrawalPosted Dec 8, 2014, 1:55 AM EST
it will skip one number and continue form another number...
for example: in for loop we are printing 1 to 10 numbers and in that case if we are printing 5 number the we written in if statement that (if I==5) then we write continue statement, then in output it will print 1 to 4 and it will skip 5 and then continue to print 6 to 10.
kiran raoPosted Nov 14, 2014, 8:24 PM EST
it will skip one number and continue form another number...
for example: in for loop we are printing 1 to 10 numbers and in that case if we are printing 5 number the we written in if statement that (if I==5) then we write continue statement, then in output it will print 1 to 4 and it will skip 5 and then continue to print 6 to 10.
kiran raoPosted Nov 14, 2014, 8:24 PM EST
It skips the rest of the current iteration and start the next iteration execution.
santhy chandranPosted Nov 14, 2014, 1:31 PM EST
Basically 'Continue' is a branching statement means when is found in a code,compiler understand to continue the same thing that's why the rest part of code is not executed and loop continuous works until condition satisfied.
Piyush R.Posted Nov 12, 2014, 4:00 AM EST
The code for the rest of the loop is ignored, the control is transferred back to the beginning of the loop.
balaji jadavPosted Oct 31, 2014, 2:12 AM EDT








