JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Looping to Execute Statements Repetitively

You use loops to execute a series of statements repeatedly. Of course, that doesn't mean you perform one identical task repeatedly; you might be operating on different data items each time through the loop. Loops are one thing that computers are great at-providing you with a way of executing repetitive code quickly. You can also have nested loops, where one loop encloses another-any of the Visual Basic loops can be nested with other loops of the same or other types.

Many programmers have a love/hate relationship with looping, based primarily on syntax. Programmers often have to switch back and forth these days between languages, and can find themselves writing, for example, a C++ loop in the middle of a Visual Basic program, and being taken by surprise when the compiler objects.

To make it easier, we'll include examples here of all the Visual Basic loops, starting with the Do loop.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor