 In the preceding videos, the reason we had to do input before the loop and at the bottom, or set a boolean to tell whether the loop is done, is because the while loop checks for the condition before it does the loop body. If the initial test of the condition comes back false, the loop body never happens at all. But we need to ask for input at least once. To handle the case when you want to go through a loop at least once, Java provides the do-while loop, whose flow chart looks like this. The loop body happens first, and then the condition gets tested. You are guaranteed at least one trip through the loop. Here's how you write it in Java. You must follow the condition with a semicolon to end the do-while statement. Here's the code for our leap year test program using do-while. We start with do, and in the body of the loop, we'll prompt for input. If it's not zero, we'll check to see if it's a leap year or not and print the result. We do all of this as long as the year is not equal to zero. Let's compile and run it and see that it works exactly the same as the others. In summary, while test the condition first, if it's false, the loop body won't be executed at all. Do-while test the condition last, the loop body will be executed at least once.