读书人

怎样退出三重循环,该如何处理

发布时间: 2012-01-13 22:43:29 作者: rapoo

怎样退出三重循环
for i = 1 to n
for each x in y
for j = 1 to n
if ...then
跳到i循环
next j
next x
next i

[解决办法]
用 goto 简单

VB code
for i = 1 to nfor each x in yfor j = 1 to n   if ...then      goto ForOver   End Ifnext jnext xnext iForOver:
[解决办法]
探讨
用 goto 简单

VB code

for i = 1 to n
for each x in y
for j = 1 to n
if ...then
goto ForOver
End If
next j
next x
next i
ForOver:

[解决办法]
探讨
for i = 1 to n
for each x in y
for j = 1 to n
if ...then
跳到i循环
next j
next x
next i

读书人网 >VB

热点推荐