Loops let you to run the commands and the statements they contain over and over again, until a certain loop end state (called an exit condition) is achieved. Referring back to Figure 1-6, you can see an example of a loop in a Do ... Loop construct, which allows users to repeatedly enter birth dates or commands until they type a whitespace (a space or a tab or a return) at the command prompt. When that happens, the variable input stays empty, and the loop reaches its exit condition, which was defined after the keyword Loop.

In addition to Do ... Loop, Visual Basic recognizes For ... Next loops, which repeat all internal statements until a counter variable has exceeded or dropped below a specified value. Also, in Visual Basic, you can use ...

Get Microsoft® Visual Basic® 2010 Developer’s Handbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.