SQL PHP HTML ASP JavaScript articles and free scripts to download

ASP for Next Commands syntax

We can fix the number of looping across a code block to be done by using for next looping. This is one of the common scripting commands used in different languages. PHP for loop is here. Let us start with the basic syntax of for next loop.

For count_start to count_end 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.

Be the first to post comment on this article :


Google+

Further readings
If Else & ElseIF conditional program structure control in ASP
Matching options by using Select Case statement in ASP
Do While Wend Loops in ASP
For Next Loop in ASP
Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked



Join Our Email List
Email:  
For Email Newsletters you can trust
HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2014 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer