教程集 www.jiaochengji.com
教程集 >  脚本编程  >  Asp  >  正文 asp For Next 循环语句语法与实例

asp For Next 循环语句语法与实例

发布时间:2016-10-01   编辑:jiaochengji.com
教程集为您提供asp For Next 循环语句语法与实例等资源,欢迎您收藏本站,我们将为您提供最新的asp For Next 循环语句语法与实例资源

For Next循环使用时,你要执行一段代码多次集数。语法如下:
For counter = initial_value to  finite_value [Step increment]
  statements
Next
For语句指定计数器变量及其初步和有限的价值。 Next语句增加了对抗一个变量。可

选的步骤关键字允许增加或减少的值指定计数器变量。

有一个很简单的例子:

<%@ language="vbscript" %>
<%
For i = 0 to 10 Step 2 'use i as a counter
 response.write("The number is " & i & "<br />")
Next
%>

复杂实例

Select ActionSelect AllTry It<%@ language="vbscript" %>
<%
response.write("<h1>Multiplication table</h1>")
response.write("<table border=2 width=50%")

For i = 1 to 9             'this 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>")
%>

您可能感兴趣的文章:
asp For Next 循环语句语法与实例
asp exit用法与exit实例教程
asp For Each语句实例
asp do while 循环语法与do while实例教程
使用循环语句
ASP脚本循环语句
Python break用法详解
python中如何退出for循环
javascript中的for语句
jquery $.each 和for怎么跳出循环终止本次循环

[关闭]
~ ~