Teledyne LeCroy WaveExpert 100H Operators Manual User Manual
Page 284
![background image](/manuals/353451/284/background.png)
Operator’s Manual
282
WE-OM-E Rev A
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
Next
Omega = TwoPi / Period
For N = 0 To Period
Y (N) = A * Sin (Omega * N)
Next
Be careful about changing the counting variable in any loop. You can do this to terminate the loop