在vb中用于强制退出for循环的语句是什么。
2015-12-21 · 做真实的自己 用良心做教育
千锋教育
千锋教育专注HTML5大前端、JavaEE、Python、人工智能、UI&UE、云计算、全栈软件测试、大数据、物联网+嵌入式、Unity游戏开发、网络安全、互联网营销、Go语言等培训教育。
向TA提问
关注
展开全部
1。加个过程就可以,这样的好处是你不需要在循环上写那么多的判断代码!
For a = 0 To 100
Ok
Next a
Private Sub Ok()
For b = 0 To 100
For c = 0 To 100
If Text1.txt = "I Love You" Then Exit Sub
End If
Next c
Next b
End Sub
2。使用行跳转
For a = 0 To 100
For b = 0 To 100
For c = 0 To 100
If Text1.txt = "I Love You" Then
Goto OK
End If
Next c
Next b
ok:
Next a
3.使用变量检查
For a = 0 To 100
For b = 0 To 100
If Ok then Exit For
For c = 0 To 100
If Text1.txt = "I Love You" Then
OK = True
Exit For
End If
Next c
Next b
Next a
For a = 0 To 100
Ok
Next a
Private Sub Ok()
For b = 0 To 100
For c = 0 To 100
If Text1.txt = "I Love You" Then Exit Sub
End If
Next c
Next b
End Sub
2。使用行跳转
For a = 0 To 100
For b = 0 To 100
For c = 0 To 100
If Text1.txt = "I Love You" Then
Goto OK
End If
Next c
Next b
ok:
Next a
3.使用变量检查
For a = 0 To 100
For b = 0 To 100
If Ok then Exit For
For c = 0 To 100
If Text1.txt = "I Love You" Then
OK = True
Exit For
End If
Next c
Next b
Next a
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询