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
Amazon Auto Links: No products found.
you could’ve put num++; after do (remove the other num++) and changed int num = 1 to int num = 0 to simplify the code
if we remove continue from the code then also the output is same. then what is the use?
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” 🙂
Thank u dude….!
Ending was hysterical!….rofl!
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
amazing…………
would i need num++ in a for loop?
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");
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
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.
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.
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.
You are amazing ! I hope you get very rich .
could you write printf (“%d is available /n”, num) before you add the if statement? would it change the program?
Why can’t we use for loop here?
Bucky for president!
try making the 2 numbers to skip 5 and six or 3 and 4 and you will see why you need continue,
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.
interesting …. if you remove continue, the result is exactly the same. why do we need it ?
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
not so clear video
+thenewboston
Bucky since you are very good at C did you try the EspressIf wifi microcontrollers ?
It is pretty clear and very nice. Thank you
you r awesomeeee))) tnank youuu )))
Please zoom in or increase the font.. couldn’t read anything on the screen.
But if the code skips the next line how does it print because the next line was a print statement
You are the best code tutor on the entire web. Seriously.
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.
this guy is just awesome
I’ve been coding for years, and I’ve never heard of continue. I’m already thinking through ways to use it.
when do we need to use do while or for or while loop…. cant we make this program using for loop….