Hello, welcome to the 24th tutorial in the c++ programming series and in this problem we look at the world in general life how to be repeated, repeated, repeated, repeated, helping reduce code. This can be useful for example, if you have an array of high school and you want to print out in school so if you have an essay for school, you could logically say, Yeah, I can just like write an individual line to print it out. But if you have 100 or 1000 that we remove, then you don't want to print in at all copy and paste in that many line closely allows it to be to make dynamic and a lot more than just printout array of high school. The while loop in particular is similar to the folder which we looked at in the previous tutorial for loop has three parts. The first part is initializing any stem variable next file condition they initially run and then the poverty saw the increment decrement pie usually will you is the part we affect the world.
They created in the first part, but the while loop only takes a single condition and a single statement and this is the condition anything to set up for the variables that should be done beforehand or assumed based on beforehand. And any sort of like any changeable variables should be done within the loop itself usually at the end, but that's not always the case. But let's show you a simple example of how the wall works. Okey dokey. So let's discuss this a second I also create a local variable enjoy equals zero and this is essentially our iterator which we would have declared within a for loop then you wrote water. Then in here you write the initial wall height less than five.
We're going to do st the sea see. I see And at the end, we are just going to put a plus plus. Now we can run it. It's printed 01234. But if we Sorry about that, if we don't put this and just want to serve up this notification, we essentially get a infinite loop. And this is something that you don't want.
There may be certain instances that you want infinite loop. But generally, you're a bit more of an experienced programmer, and you will hopefully know what you're doing. But yeah, this is not the result that we want, because we haven't actually put the increment statements in is quite funny CPUs, in fact, 85% 83% memory, low energy impact, very high. kind of fun, i plus plus. And now if we just run this, there are 1234. That's it for the wall loop in the next Part One, we're looking at the do one which is very similar to the wall as well.
If you have any questions feel free to message us at support at sonar system the curriculum. The email will be in the description you can contact these videos directly messages or YouTube. Wherever you feel comfortable with. All the recording source code will also be in the description as usual. Thanks for watching and I hope you have a nice day.