Loops in Visual Basic


A Loop (repetition structure) allows the programmer to that an action is to be repeated until given condition is true.
Do While.........Loop

The Do While...Loop is used to execute statements until a certain condition is met. The following Do Loop counts from 1 to 100.

Dim number As Integer
    number = 1
Do While number <= 100
   number = number + 1
Loop

A variable number is initialized to 1 and then the Do While Loop starts. First, the condition is tested; if condition is True, then the statements are executed. When it gets to the Loop it goes back to the Do and tests condition again. LEARN MORE>>>>>>

No comments: