C Programming Tutorial – 30 – continue

Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts

Comments

nathnolt says:

you could’ve put num++; after do (remove the other num++) and changed int num = 1 to int num = 0 to simplify the code

shourya sharma says:

if we remove continue from the code then also the output is same. then what is the use?

John Doe says:

Love your tutorials, however in this one I noticed you are reading “num == 8” as “num equals 8”. I think to avoid confusion you should read it as “num is equal to 8” 🙂

chamodya kumarasinhe says:

Thank u dude….!

Divyam Patro says:

Ending was hysterical!….rofl!

Akshay Gandhi says:

i tried the same program you did but its output is same without using(continue).
this means continue statement which u use is not working for this program .
please help me

Rohitesh Upadhyay says:

amazing…………

AtMyMaple says:

would i need num++ in a for loop?

rank AS5 oddshots says:

do {
      if( num == 6 || num == 8){
               printf(“%d is takenn”,num);
               num++;
               continue;
               }
      printf(” %d is available n”,num);
    num++;
      }while(num<=10); printf(" i like this continue thing");

Joe Drizzle says:

I was sitting here trying to understand what the continue was doing and I just didn’t get why you couldn’t just take it out, so I did, and it had the same result anyways. wut up w/ dat

Muhammad Bilal says:

If anyone finds this a little confusing which you should, because removing “continue;” also gives the same result, try adding a printf before the if else statement. for example:-

do{
if( num != 6 && num != 8 ){
printf(“ssssssssssn”);
}
if( num == 6 || num == 8 ){
num++;
continue;
}
printf(“%dn”, num);
num++;
}while( num<=10 ); If you remove the "continue;" you will see that as number 6 changes to number 7 in the second if statement, the function DOES NOT START OVER; it keeps running and prints 7. we originally wanted it to print "ssssssss" before 7 (because it is not 6 or 8), but "ssssssss" does not get printed before 7. On the other hand if you do not remove "continue;" you will see that the do part STARTS OVER after number 6 changes to 7 and the first if statement is run again. "sssssss" gets printed before 7 this time.

Travis Alsup says:

without the continue that particular incident would have resulted the same to the end user because num++ before like in printed with or without continue.

Vladimir Putin says:

Guy 1: hey dude, I thought of a perfect statement that is going to skip a piece of code and continue running the rest of it. Lets call it *continue*.
Guy 2: why not *skip*?
Guy 1: nah.

No Bullshit Poems says:

You are amazing ! I hope you get very rich .

anon imus says:

could you write printf (“%d is available /n”, num) before you add the if statement? would it change the program?

Manik Chugh says:

Why can’t we use for loop here?

Dickpuncher says:

Bucky for president!

Travis Alsup says:

try making the 2 numbers to skip 5 and six or 3 and 4 and you will see why you need continue,

Jonah Thao says:

back when i was in school learning java. I needed a code like this. I was doing an RPG like battle system with a windows gui and stuff. If only i knew the java version of this i would of been all set. 

Aleksandra rudnitskaya says:

interesting …. if you remove continue, the result is exactly the same. why do we need it ?

apratimambade says:

I think he is wrong in explanation of the program
when when it checks 6 or 8 it doesnt skips but it increments.
and continues the program without “loop is not missed”.
But as in break it exits the loop

Tannya Seth says:

not so clear video

Talha Kamran says:

+thenewboston
Bucky since you are very good at C did you try the EspressIf wifi microcontrollers ?

Eric Zhang says:

It is pretty clear and very nice. Thank you

Рожко Олена says:

you r awesomeeee))) tnank youuu )))

Zdarr says:

Please zoom in or increase the font.. couldn’t read anything on the screen.

HNK2015 says:

But if the code skips the next line how does it print because the next line was a print statement

AbdulRahman Geddawi says:

You are the best code tutor on the entire web. Seriously.

Ashutosh Sahu says:

Even if we remove continue, its giving the same result. Why its not going to the next part of loop? i.e. it should print 6 also.

subash khadka chhetri says:

this guy is just awesome

Will Moffat says:

I’ve been coding for years, and I’ve never heard of continue. I’m already thinking through ways to use it.

Savio meitei says:

when do we need to use do while or for or while loop…. cant we make this program using for loop….

 Write a comment

*

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!