 Hey everybody, this is Brian and this is our eighth video in the Visual Basic series. Today we're going to be discussing loops. So to start off, just create a variable called number, whoops, and make it an integer, and give it a value of zero. Type the word do and hit enter. And you notice how it puts this loop in here. What this does is it creates a loop between do and loop. Anything between those two is going to be repeated. So what we're going to do is we're going to say console.rightline, and we're just going to print the variable out. And then number equal number plus one. We'll increment it. Now before you run this, let's put a little logic in here to break out of this loop. If you don't, it's just going to run forever and ever and ever and ever. Well, not really. It'll eventually hit the upper limit of what an integer can hold, then it'll have an error and crash. So, follow along. If number is greater than, let's say, 10, then, and we will type exit do. And you notice how it gives you do or sub? The exit statement branches out, meaning when it goes through this loop, it will increment number. And then it's going to check the value of the number. And if it's greater than 10, we're going to exit do, meaning we're going to exit this loop. Now you could exit right out of the subroutine, which will stop your program. This is the subroutine, sub main. We'll cover that in another tutorial. But for this one, just exit do. Now when we run this, you'll see your window spits out 0 through 10. Let's review this, because this is going to be a difficult topic for some of you newbies. You have a variable, and you're giving it an initial value of 0. This is our loop. Anything between do and loop is going to be repeated. So we're saying console, right-line, the number, and then we're going to increment the number. If the number is a certain value, or I should say greater than a certain value, we're going to exit out of the loop. Now let's just comment that out, just so you can see what happens. Run it, and as you can see, it just keeps running and running and it'll eventually crash, but I'm just going to stop it before it does. So if you are working with a loop and it just keeps running, then you did not break out of it at some point. Now there's an easier way of doing this. I'm just going to delete that code. And it's do until, and then you give it the variable, number, and we'll say equals 10. It's the same thing. It just encapsulates that break logic right here. So instead of putting an F statement, it's already there. Do until number equal 10. So we're going to say number equal number plus 1, console dot right-line, number. And you notice how we are not putting an exit do in here. The reason why is we're saying if that number's 10, and you can put greater than, or you can put greater than or equal to, we'll cover these symbols in another tutorial. But really what we're saying is do until the number is greater than or equal to 10. Number is being incremented. It's just going to loop and loop. So run this. You see we get the same results, 1 through 10. Now there's also another way of doing it. I'm just going to copy this logic because we're just going to do the same thing essentially. I'm going to go do. And you notice how there's do, do until, and do while. Well, this time we're going to do do while. And we're going to say number is less than 10. And run this, and you see we get the same results. Now you might be wondering, what is the difference between do, do until, and do while? Well, that's a good question. That's your homework for the night. So go ahead, hit Google, look it up, email me your responses, and let me know. I hope you found this video educational and entertaining, and I thank you for watching.