 In the preceding video, we had to ask for input twice, once before entering the loop, and then at the bottom of the loop to get the next number. Here it is in the code where we do input outside the loop and inside the loop at the bottom. Depending on your philosophy of programming, this is inelegant because it duplicates code. We'd like to do the input only once inside the loop. Here's the pseudo code. The key is to set a boolean that tells us whether we have finished or not. The initial value is false because we're just starting, so we're certainly not finished yet. As long as we're not finished, we ask for the year. Say the user enters 2023. 2023 is not zero, so we determine whether it's a leap year or not. It isn't. And print the result. We then loop back to our condition. Finished is still false, which means not finished is true, and we have to do the loop by the again. We ask for the year again, and this time let's have the user enter zero. Now our condition is false. Zero is equal to zero. We set finish to true and loop back to test the condition. The condition evaluates as not true, which is false, and that ends the loop. We'll add the variables for the year and the boolean finished, which starts off as false. We'll put in the while with the condition not finished, indent the loop body, and put in the closing curly brace for the while. Since we've already declared year in line 14, we don't need to declare it again in line 20. After we get the input, we need to check if year is equal to zero or not. If the year is not zero, then the body of the if gets indented. We do the leap year test. Otherwise, we set finished to true when the user enters zero, we've finished the loop. Let's compile and run it, and we can enter years to our heart's content until we enter zero to finish the program. Using the boolean to control the loop lets us write a program that needs to ask for input only once.