From the course: Visual Basic Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Use Do loops to run code until condition is fulfilled

Use Do loops to run code until condition is fulfilled - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Start my 1-month free trial

Use Do loops to run code until condition is fulfilled

- [Instructor] The do loop is used when a loop must run continuously, until a specific condition is satisfied, then the loop ends. We've seen the do loop earlier in the course, when we created a console application that ran endlessly, until the correct key was entered on the keyboard. There's four variants of the do loop, and I'm showing them here in this endless loop method. They all start with the word do, and end with the word loop. And then you have a test condition, I can put the test condition at the end, like I'm doing in these two loops, or I can put it at the beginning, like I'm doing for these last two loops. Let's read this first example. Run the code in the loop one time, and then test to see whether the condition is true. If it's true, then loop again, once the condition is false, then you exit the loop. This one uses the until keyword, the way this would read is loop through until this is true. So as long…

Contents