May 13, 2021 VBScript
Loop statements are used to run the same block of code the specified number of times. Looping statements are used to run the same block of code a specified number of times.
In VBScript, we can use four looping statements:
Please use For... T he number of times the Next statement runs a piece of code.
The For statement specifies the count variable (i) and its initial and end values. The Next statement increments the variable (i) with 1 as the step value.
With Step keywords, you can specify the step value of the count variable increment or decrease.
In the following example, the count variable (i) has an incremental step value of 2 per loop.
If you want to decrease the count variable, you must use a negative Step value. And you must specify an end value that is less than the start value.
In the following example, the count variable (i) has a decreasing step value of 2 per loop.
You can opt out of For... Next statement.
For Each... Next repeats a piece of code for each item in the collection or for each element in the array.
If you don't know how many times to repeat, you can use Do... Loop statement.
Do... T he Loop statement repeats a piece of code until the condition is true or the condition becomes true.
You can use the While keyword to check Do... T he condition of the Loop statement.
If i is equal to 9, the code in the loop above will terminate execution.
The code within this loop will be executed at least once, even if i is less than 10.
You can use the Until keyword to check Do... T he condition of the Loop statement.
If i is equal to 10, the code in the loop above will terminate execution.
The code within this loop will be executed at least once, even if i equals 10.
You can opt out of Do... L oop statement.
The code within this loop will be executed as long as i is not 10 and i is greater than 10.
Loop through the title
How to loop through the six titles in html.
Do...
While loop
How to do a simple
Do... W
hile
loop.