Hello world! I'm talking about for loops. in C#. [sharp] I have a program with a listbox called lstNumbers. And in the last lesson. In form load, Added the numbers 1, 2, 3 To the list box using a while loop. I've added a line to put the word "while" in the list box first. and num is 1. And while num is less than 4. I add num to the list box. And then I increment num. Let's just run this so you can see what we have there: we have the word "while" and then 1, 2, 3. Is what was added to that box. So num was 1, let's jump forward to the point where num becomes three. And we would have just added 2. And num becomes 3. 3 is less than 4. So we add three to the list box. We increment num and it becomes 4. (num<4) is no longer true, and we jump down to the next line after the body of the loop. Another way, of writing a loop It's called a for loop. I did the while loop first because I think it's easier to understand: we have an initial value; we have a test; And we increment. [num++] A for loop Has [three] parts: We have the word for, Then we usually have a variable. And the variable that drives the loop is usually a single letter, just traditionally, but it could be anything you want. And I'm going to give it an initial value Right here. Then there's a semicolon [ ; ] And then we have our test. Another semicolon [ ; ] And we have what we want to increment At the end of the loop, And then we have our curly braces. With the while loop, We declare num with a value of 1 before the loop. Here we're going to do that same thing. as the first part Of the for loop statement With the while loop, Then have the test. And with the for loop, that test Is going to be the second part. of the for loop And we incremented the variable as the last thing inside the loop. This is also the last thing that happens in the loop, but it's part of that whole statement. Now all we have to do. add that, Just for fun I'm going to also add "for" Let's run that so you can see what happens: the while loop Added 1, 2, 3. And then the for loop added 1, 2, 3. And so you can see. That's a nice comparison. Of a while loop. where the separate parts are put in separately. And with the for Loop. Those same three parts. Are put in the headerr for the loop. A for loop is a specially good when you want to count, and you know exactly how many items you want to put into the loop. We'll talk about this more in later lessons.