So in this topic, we are going to deal with iteration. Iteration is critical to computation being useful. If everything was simple and a few lines of direction where we could finish them one step at a time, we'd largely wouldn't need computers. The reason computers are so powerful is they can do trillions or millions of trillions of operations in a relatively short time which is impossible for humans or even humans aided with mechanical calculators to do. So this is a true critical topic. If you master this topic, you have an enormous amount of the utility of writing code and programming. Here, we're going to study the while statement. The while statement is fundamental, it's the simplest form of iteration statement. We're going to see in a little bit a more sophisticated form which will be the fourth statement. But it's best to understand the while statement that'll make it very easy to understand the for statement as well. So the while is syntactically while paren with some expression, close paren with some statement. Most normally that statement is what's called the block or a compound statement namely it's really a statement that is an open brace and a closed brace with a bunch of statements in between. So you can do more than one statement action that makes it very useful. Here are the semantics. What we do is recheck first to see if the expression is zero. If the expression is zero, the statement is not done. It's omitted and we just skip to whatever is next. We can think of that as false. Though really in C false is zero and true is non-zero. However, if the expression is non-zero, then we execute the statement that's sitting under the while. Then, we repeat. We go back and ask is the expression is zero we continue. That just keeps going until we see the expression is zero. Here's an example. While i less than 10. So that expression is relational expressions. So that's, it's frequently what we'll see as a test. Also this is idiomatic in the sense that very frequently in an iteration you do something that is involved counting and counting normally uses integer variables. So in this case, i is assumed to have been declared as an ent of some value typically less than 10. Otherwise, this wouldn't be executed, and we'll check. If i is less than 10, then we continue. Into this compound or block statement, we do the print F, i equals and we print out the current value of i. Then again, very common in iterative statements as we see an auto increment of i. So here's an auto increment of i, we add one to it. Why? Because we want repeated behavior but ultimately we want to exit the loop. So lets say i starts at zero, we will print zero and then we will print one, then we'll print two, and so forth until i hits 10 and then we will stop. So this is canonically a very simple loop but it still has many of the characteristics of [inaudible] and the most sophisticated loop pass. There's something where there might be a counting variable. There's some action, this may be actually a whole series of actions, a series of calculations. This just goes on and on until we exit this loop. In the old days, we used to exhibit this behavior what we call the flowchart. So here's a flow chart for this while loop. We have a test. The test is false. This is a false part. Let me indicate that. So false again, keep in mind false is zero. Otherwise, non-false we execute non-zero. So the statement often a compound statement. Then we go back from here and retest whatever this test expression is. In that case, it was i less than 10 in that example. So we enter the loop as a while statement. We do a test. We either exit when false or we continue and do some execution, and then we loop test exit may be. Or if not exit, repeat and keep going. If we avoid exiting, we get into what is called an infinite loop and that's something that you would have to make sure you don't want. It eats up computer time. Generally speaking, it means you've created an error in your program.