Teledyne LeCroy WaveExpert 100H Operators Manual User Manual
Page 282

Operator’s Manual
280
WE-OM-E Rev A
If Boolean Then
AnyVBScriping
End If
If Boolean Then
AnyVBScripting
Else
AnyOtherVBScripting
End If
If you write a list like this, all the Booleans will be evaluated, whether you want that or not:
If A > 9 Then VBScripting1
If A > 7 Then VBScripting2
If A > 6 Then VBScripting3
If A > 4 Then VBScripting4
If A > 3 Then VBScripting5
If A > 1 Then VBScripting6
Be very careful when testing for equality. There will be no trouble with Integers, Long Integers, and
Strings, but Real numbers are different. Because they have so many significant digits, values that
should be equal, may differ minutely after a computation. It is safer with Real numbers to test using
a tolerance band.
File for this example: IfThenElse.xls
If you find that you are building up a rather complicated set of Ifs, you might want to consider the
Select Case construction.
Select Case
This is a very powerful construction, which is also easy to understand when written out. It is best for
Integers and Strings, where exact values are always obtained. Here is a simple example:
Select Case K
Case 7 : Y = 6 : Z = 3
Case 7 : Y = Sqr (Sin (A) ) : Z = Sqr (Cos (A) )
Case N : Z = Y + X
Case Else :
End Select
Case N assumes that the value of N has already been set. Case Else is included to cover other