powerbuilder语法 asp do while 循环语法与do while实例教程
asp do while 循环语法与do while实例教程
在do while循环的另一种常用后 Next循环的循环 在do while循环语句重复语句
块的次数不定 重复的陈述或者当条件为真或直到条件变为True 语法如下所示
Do [While|Until] condition statements Loop
Do statements Loop [While|Until] condition
在这方面 这个循环内的代码将执行至少一次的情况 在有一个例子
下面的例子定义了一个循环 开始与i = 循环将继续运行 因为我只要小于或等于
我将增加 每次循环运行 Select ActionSelect AllTry It<% Dim i use i as a counter i = assign a value to i
Do While i<= Output the values from to response write(i & "<br >") i = i + increment the value of i for next time loop executes Loop %> 现在 让我们考虑一个更有用的例子 创建下拉几天 几个月或几年清单 您可以使
用此登记表的代码 例如

<% creates an array Dim month_array( ) month_array( ) = "January" month_array( ) = "February" month_array( ) = "March" month_array( ) = "April" month_array( ) = "May" month_array( ) = "June" month_array( ) = "July" month_array( ) = "August" month_array( ) = "September" month_array( ) = "October" month_array( ) = "November" month_array( ) = "December"
Dim i use i as a counter
response write("<select name=day"">" & vbCrLf) i = Do While i <= response write("<option value=" & i & ">" & i & "</option>" & vbCrLf) i = i + Loop response write("</select>")
response write("<select name=month"">" & vbCrLf) i = Do While i <= response write("<option value=" & i & ">" & month_array(i) & "</option>"
& vbCrLf) i = i + Loop response write("</select>")
lishixinzhi/Article/program/net/201311/14309