C Programming Tutorial – 30 – continue

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

32 responses to “C Programming Tutorial – 30 – continue”

  1. shourya sharma Avatar

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

  2. HNK2015 Avatar

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

  3. apratimambade Avatar

    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

  4. Eric Zhang Avatar

    It is pretty clear and very nice. Thank you

  5. AtMyMaple Avatar

    would i need num++ in a for loop?

  6. No Bullshit Poems Avatar

    You are amazing ! I hope you get very rich .

  7. Aleksandra rudnitskaya Avatar

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

  8. Akshay Gandhi Avatar

    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

  9. Tannya Seth Avatar

    not so clear video

  10. Zdarr Avatar

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

  11. Muhammad Bilal Avatar

    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.

  12. Vladimir Putin Avatar

    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.

  13. Divyam Patro Avatar

    Ending was hysterical!….rofl!

  14. Ashutosh Sahu Avatar

    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.

  15. Savio meitei Avatar

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

  16. Travis Alsup Avatar

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

  17. Travis Alsup Avatar

    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.

  18. Рожко Олена Avatar

    you r awesomeeee))) tnank youuu )))

  19. Talha Kamran Avatar

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

  20. Manik Chugh Avatar

    Why can't we use for loop here?

  21. anon imus Avatar

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

  22. Joe Drizzle Avatar

    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

  23. rank AS5 oddshots Avatar

    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");

  24. Dickpuncher Avatar

    Bucky for president!

  25. AbdulRahman Geddawi Avatar

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

  26. nathnolt Avatar

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

  27. John Doe Avatar

    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" 🙂

  28. Gameplay Medley Avatar

    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. 

  29. Will Moffat Avatar

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

Leave a Reply

Your email address will not be published. Required fields are marked *