 Let's go ahead and talk about the for loop. For this example, I've also included the array from the standard library We're gonna say int max equals zero Let's go ahead and queue info. I'm gonna cn to our max and Then we're just gonna do a little bit of information checking here. Whoops forgot to Double-shed around there we go if max Less than or equals zero Queue fatal. Let's go ahead and shut our program down Please enter a valid number Nothing major here, but let's take a look at the four statements. So here's our for loop What we have here is we have four parentheses. So we know we're evaluating something and a block of code The for evaluation actually has three parts and this gets a little confusing if you're new to programming it It I equals zero and then semicolon Remember that in C++ semicolon denotes that we're stopping For example, we could take this and actually do that That's a valid C++ command. It ignores the white space. It's just gonna read right up until it gets to this semicolon So because of that understand whenever you see the semicolon, it means stop So this is one little bit of code right here We're making a variable called I and we're going to give it a value of zero We're also going to say I Is less than max so we have an expression here Then we want to say I and we're gonna increment So what's really going on here is we're making a variable or a starting position we're telling the loop when to stop the I should be less than the maximum and We're telling it what direction we want to go positive or negative. We could have very easily said decrement In other words going from 100 to zero But in this case we want to go from zero to 100 or whatever maximum we give it So while this whole expression is true Run this code. We'll say I equals and let's just Display that variable Save and run this and let's enter a max. We're gonna do it 10 times. So from zero to nine Where'd the zero come from? Well, it's right here. I equals zero. We could have very easily said I equals one And let's actually do that and we have our one through nine If you're wondering why we didn't get that number 10, it's because we want that to be less We can say less than or equal to And it'll print out our 10 Ta-da typically, you'll see a for loop starting with a zero and Less than your max and there's a reason for that It's because you'll typically work with a for loop when you're working with what's called a list or with an array Let's go ahead and make an array because we haven't covered lists Say int we want four of these Call ages And we've just got four different ages in there now Let's make a for loop to kind of iterate through these things and then we want I is less than Ages that size And then we want to increment as we go So really what we're doing here is we're saying create a variable called I equals zero We want to do this as long as I is less than our array size in this case. It's going to be four And then each time we're going to increment so we're going from zero to one to two to three to four All right, let's go ahead and pump this out and we're going to say cue info and I want to say Looks pretty nasty and we've got some warnings going on here But this should work notice how we're changing the sign this and We've got integers of different signs and things like that. We can safely ignore those warnings for now Let's go ahead and run this center max 10 And you can see it did what we expected it to for this loop This loop we really didn't need to enter anything but uh, we have our numbers. What is it 44 56 32 16 So it's starting at the zero position. Remember arrays are zero base. So we want to start at the zero index That's typically why you'll see a for loop start at zero because you're typically going to work with an array or something of that nature Where the starting point is zero Pretty easy to understand but pretty darn powerful once you get into it I hope you enjoyed the video you just watched that was a preview of one of the videos out in the Cute core for beginners with c++ course. I have out on you to me I am going to be making an intermediate in advance and then we're going to start working on gooey technologies For example showing buttons lists tree views you name it and then moving on to things like qml um The reason why I've restarted this whole thing is if you're watching these videos out on youtube, they are a little old This one was done in 2011 and the technology has changed over time So because the technology has changed some of these videos as good as they are Really don't line up with the current cute technology stack anymore. So I wanted to start from scratch I hope to see you out on you to me and also in the voidrums facebook group. See you there