Do/Loop |
For-Next Loop |
Do-Loop construct is used when we don?t know how many iterations will be performed. | When we know the exact number of execution on the block of code, For-Next construct is used. |
Do-while tests the loop condition each time through the loop & it keeps executing while the test expression is a true value | To use this construct we have to use a counter. We will always loop from star value to some end value. |
In this we will have to specify the increment number. | In For-Next loop always increment by one by default |
General Syntax is : Do while <condition> <statements> Loop | General Syntax is : For intCounter = intStart to intend [step to increment] <statements> Next [intCounter] |
Ex. Dim intNum as integer Do While intNum < 100 lblNumber.Caption=intNum intNum = intNum + 1 | Ex. For intCount = 1 to 5 Form1. Print intCount Next |