X-Stream Operator’s Manual 
WM-OM-E Rev I  297 
Loop Until D > Pi 
Do Until Z < Y 
AnyVBSCalculation 
Loop 
Do  
AnyVBSCalculation 
Loop While D <= Pi 
Do While Y >=Z 
AnyVBSCalculation 
Loop 
These constructions enable you to make the test before or after the calculation. If before, the 
calculation might not be done even one time, if the condition for terminating were already true. With 
the condition at the end, the calculation is done at least one time. 
Sometimes you might want to exit the loop from somewhere inside: for example, if some kind of 
problem is looming, such as the logarithm of a negative number. 
For this case, you can use If . . . . Then Exit Do. 
To make a pause of 10 seconds you can write: 
     NewTime = Timer + 10.0 
     Do Loop Until Timer >= NewTime 
where Timer is a clock function in the PC, which has a resolution of one second. 
Example file for these constructions: DoLoops.Xls 
While . . . Wend 
This is similar to Do While . . . Loop. You can write things like: 
     While ( (A > 2) And (C < 92677663) )  
     AnyVBCalculation 
     Wend 
For . . . Next 
Sometimes you know, or you think you know, the number of times that you want to do a job. For this 
case a For loop is ideal, especially when you have an array of numbers to work with. 
Examples: 
     For K = 0 To Total 
     HistogramBin (K) = 0