做...循环直到有多个条件 [英] Do... Loop Until with multiple conditions
问题描述
我有一个简短的问题,关于哪些我没有在网上找到具体信息。
我想执行 Do ... Loop直到
循环,但是我想在末尾插入多个条件。我想做:
Do
'...我的代码...
循环直到[条件1]和[条件2]和....和[条件n]`
是
非常感谢,奥兰多
以下示例显示了懒惰的评估实现:
Do
'一些操作
选择错例
情况1
情况2
情况3
情况N
否则退出
结束选择
循环
此类代码可提高性能并加快代码执行速度。它会逐个评估条件,直到仅出现第一个错误结果为止,如果所有条件都为真,则退出循环,而传统的和
运算符将评估所有条件,而与结果无关。 p>
I have a quick question about which I did not find specific information on the web.
I want to perform a Do...Loop Until
loop, but I would like to insert more than one condition at the end. I would like to do:
Do
' ...my code...
Loop Until [Condition 1] And [Condition 2] And....And [Condition n]`
Is this possible?
Thank you very much in advance, Orlando
The below example shows lazy evaluation implementation:
Do
' some operations
Select Case False
Case Condition1
Case Condition2
Case Condition3
Case ConditionN
Case Else Exit Do
End Select
Loop
Such code allows to improve performance and speed up code execution. It evaluates conditions one by one until first false result only, if all conditions are true then it exits the loop, while conventional And
operators evaluate all conditions regardless of the results.
这篇关于做...循环直到有多个条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!