For counter = startValue To endValue Step 1
Script block
Next
count_start is the variable stores the initial value of the count, count_end is the final value of the loop and the value of count_start increases by the value of step. Default value of Step is 1. Here is a simple code to display number 1 to 10 by For Next loop.
Dim i
For i=1 to 10
Response.Write i & "<br>"
Next
The code above will print number 1 to 10. We can modify the code by adding a step value of 3 like this.
Dim i
For i=1 to 10 step 2
Response.Write i & "<br>"
Next
The output of the above code is 1 3 5 7 9 with line breaks after end of every number.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.
| robotran | 31-07-2014 |
| very helpful | |
28-08-2020 | |
| <% fromDate="1-Aug-2020" toDate="28-Aug-2020" nood=DateDiff("y",fromDate,toDate) for i = 0 to nood ddt =(DateAdd("d",i,fromdate)) response.write day(ddt) &"-" & mid(monthname(month(ddt)),1,3)&"-"&Year(ddt) & "<bR>" next %> | |