ASP for Next Loop statement syntax and instance

Source: Internet
Author: User

For Next loop, you have to perform a number of sets of code multiple times. The syntax is as follows:
For counter = Initial_value to Finite_value [step increment]
Statements
Next
The For statement specifies the counter variable and its initial and limited value. The next statement increases the fight against a variable. Can

The selected step keyword allows you to specify counter variables by adding or decreasing values.

There is a very simple example:

<%@ language= "VBScript"%>
<%
For i = 0 "Step 2" use I as a counter
Response.Write ("The number is" & I & "<br/>")
Next
%>

Complex instances

Select Actionselect alltry it<%@ language= "VBScript"%>
<%
Response.Write ("Response.Write ("<table border=2 width=50%")

For i = 1 to 9 ' It is the outer loop
Response.Write ("<tr>")
Response.Write ("<td>" & I & "</td>")

For j = 2 to 9 ' inner loop
Response.Write ("<td>" & I * J & "</td>")
Next ' Repeat the code and move on to the next value of J

Response.Write ("</tr>")
Next ' Repeat the code and move on to the next value of I

Response.Write ("</table>")
%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.