由于ASP不能使用GOTO语句,我在FOR循环中加入一个FOR循环,若需要跳出,即退出最里面那个FOR循环。
DEMO:
<% dim a a = 0 for i = 1 to 10 for j = 1 to 1 a = a + 1 if i = 5 then 'a=5不会输出 exit for end If Response.write a & "<br/>" next next %>
由于ASP不能使用GOTO语句,我在FOR循环中加入一个FOR循环,若需要跳出,即退出最里面那个FOR循环。
DEMO:
<% dim a a = 0 for i = 1 to 10 for j = 1 to 1 a = a + 1 if i = 5 then 'a=5不会输出 exit for end If Response.write a & "<br/>" next next %>