Loops available in Visual Basic

In this topic, you will learn about, Loops available in Visual Basic.

The two loops available in Visual Basic are:

  1. While: While is a conditional looping statement allow to repeat given statement a number of times. It checks the condition first if the condition is true then executes the next statement. While loop initializes variable first then check condition if true execute statement and increment/decrement statement till the condition is true.                                                                                                                                             Syntax:

While Condition

2. For: For loop also allow to repeat given statement number of time but this loop use for, next, step, to keyword for declaration.” for” loop performs initialization condition checking and increment /decrement in the same line. Using for loop we can increase or decrease the counter with the help of step-1 or step-2.” for” is the simplest looping statement allow to use same as while or do while loop.
For <start> to <Stop> stop value