While; For - LeCroy WaveMaster 8600A Operator's Manual

X-stream oscilloscopes
Table of Contents

Advertisement

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
WM-OM-E Rev I
X-Stream Operator's Manual
297

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents