ASP 如何退出嵌套循环?

2025-05-12 15:19:07
推荐回答(3个)
回答1:

可以把for语句用do while ....loop代替

比如当n=10时退出循环:

do while n<10
....
....
n=n+1
loop

回答2:

没办法,只能判断了

<%
a=0
for i= 1 to 8
for h=1 to 10
if h=4 then a=1:exit for
next
if a=1 then exit for
next
response.write i&"
"&h
%>

回答3:

<%for i= 1 to 8
for h=1 to 10
if h=4 then exit for
next
if h=4 then exit for
next
response.write i&"
"&h%>