 Here's the flowchart for an ordinary while loop. Sometimes you want to break out of a loop before the condition becomes false. You use a break statement to do that. Here's an example of a program that uses break when finding the smallest factor of an integer. We start trying factors at 2. As long as our candidate for the smallest factor is less than or equal to our number, we check to see if it divides the number evenly. If so, the loop has finished. We found the smallest factor and we can break out of the loop. No else is needed here. If it doesn't divide evenly, we're still in the loop. And we add one to the factor to try the next number. This loop will exit either when the factor equals the number, which happens for prime numbers, or when we find a smaller divisor and break out of the loop. Some programmers don't like to use break as it provides a second exit point from the loop. You can either exit when the condition becomes false or when the break occurs. There are two ways to get around needing a break statement. One is to set a Boolean flag. Here we set a Boolean named found to false. The loop condition changes. We'll use the unary not operator, the exclamation point, to make our condition while not found, while we still haven't found the smallest factor, we test to see if it's divisible. If it is divisible evenly, we set found to 1. Found is true. We found it. Otherwise, we proceed to the next number as a factor. There's no chance of an infinite loop here. Eventually, the factor will equal the number, and that will give a remainder of 0. Eventually, not found will be false. We will have found it, and we'll be able to print the smallest factor. Let's build this program, run it, and try it with a number like 437, and find that its smallest factor is 19. Using a Boolean to avoid break takes more lines of code, and to many people, this code is much less readable than the version that used break. However, there is a way that you can eliminate the need for either a break or a Boolean flag. Namely, put the test for divisibility into the while loop condition. Here it is in the program. As long as the factor is less than or equal to the number, and it's not evenly divisible, move on to the next number as a factor. And again, this works just fine. The other concept that I want to touch on very briefly is continue. Continue jumps to the end of the loop and starts the next iteration. It doesn't exit the loop. This is not as commonly used as break. You can almost always use an if statement to get the same effect as a continue. Here's a program that sums up the numbers from 1 to 10, skipping over 7 and 8. It starts the number at 0. As long as it's less than 10, we add 1 to the number. And if it's 7 or 8, the continue skips us to the bottom of the loop, avoiding the addition and the printf. Let's build this and run it. And sure enough, 1, 2, 3, 4, 5, 6, 7 and 8 have been skipped, and 9 and 10 continue on. But rather than use continue, we could change our condition to say, if the number is not equal to 7, and the number is not equal to 8, then add it in. Let's rebuild and execute, and we get the same results. In summary, though you will very seldom need a continue to skip over part of a loop iteration, you'll more often see break used to provide an exit from a loop, though you should use it carefully and only when absolutely necessary.