for i=1 to 10 if ……then goto N1 '跳出本次循环 elseif exit for '跳出循环 else …… end if N1: next i
exit for 是退出正循环体 go to 能达到退出本次循环 有没有想 c 语言一样用关键字跳出本次循环执行下次循环 。
exit for 是退出正循环体 go to 能达到退出本次循环 有没有想 c 语言一样用关键字跳出本次循环执行下次循环 。
没有与C语言中break关键字对应的。
exit for 退出For 循环 相应有exit do ,exit sub ,exit function 等 也可以用 goto 标号 做跳转
Exit For 提供一种退出 For 循环的方法,并且只能在 For...Next 或 For Each...Next 循环中使用。Exit For 会将控制权转移到 Next 之后的语句。当 Exit For 用在嵌套的 For 循环中时,Exit For 将控制权转移到 Exit For 所在位置的外层循环。 可以用If...Then GoTo...加以控制
if ……then
goto N1 '跳出本次循环
elseif
exit for '跳出循环
else
……
end if
N1:
next i
相应有exit do ,exit sub ,exit function 等
也可以用
goto 标号 做跳转