for ... ... if 条件 then goto NextFor ... NextFor: next
for (条件) ………… next(asp) for (条件) ………… next i(vb) 不知楼主是这个意思吗
怎么会没有?肯定有。下面介绍一种简单的方法。dim i as integer dim count as integercount =0 for i =1 to 100 if i = 5 then i=i+1 else count =count + i end if next i看看结果就知道了,count 中没有加上5的那一个值。
最简单的办法就用控制变量加1. 很奇怪吧?不过这是本人在出现了多次错误之后发现的,For循环的next i 本来是下一个 i 的意思,当在循环中给i添加了值时,再到next i时,它就会自动跳到加了值后的那一个i. 。还有这些加1减1的,最好有控制好,不然很容易就陷入了死循环。
...
if 条件 then goto NextFor
...
NextFor:
next
…………
next(asp)
for (条件)
…………
next i(vb)
不知楼主是这个意思吗
dim count as integercount =0
for i =1 to 100
if i = 5 then
i=i+1
else
count =count + i
end if
next i看看结果就知道了,count 中没有加上5的那一个值。
我是说你的有goto,而我的没有。要象你的那样加上goto---------
幸会!