Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Jun Dong4,754 Points
What does continue; do
This is one of the quiz questions i don't understand why this code doesn't print anything
Continue allows you to control the flow of your loop by skipping the current iteration and returning back to the beginning of the loop. In your example, when you get into the loop, you are immediately taken out of it because of continue, however, because true is still "true", you are in an infinite loop that just keeps taking you out the iteration and starting back at the beginning. If something were to, for example, change the true value to false, it would go back to the beginning of loop, see that true is now false and be able to print out "Croak".
bool example = true;
example = false;