Summary Of If; Select Case - LeCroy WaveRunner Xi series Operator's Manual

Oscilloscopes
Hide thumbs Also See for WaveRunner Xi series:
Table of Contents

Advertisement

W
R
X
S
AVE
UNNER
I
End If
Summary of If . . . . Then
If Boolean Then
AnyVBScriptingOnOneLine
If Boolean Then
AnyVBScriping
End If
If Boolean Then
AnyVBScripting
Else
AnyOtherVBScripting
End If
If you write a list like this, all the
If A > 9 T
hen VBScripting1
If A > 7 Then
VBScripting2
If A
> 6 Then VBScripting3
If A > 4 Then VBScrip
If A > 3 Then VBScripting5
If A > 1 Th
en VBScripting6
Be ver
y careful when testing for equality. There will be no trouble with Integers, Long Integers, and Strings, but
Real numbe
rs are different. Because they have so many significant digits, values that should be equal, may differ
minutely after a comp
utation. It is safer with Real numbers to test using a tolerance band.
File for this e
xample: IfThenElse.xls
If you find tha
t you are building up a rather complicated set of Ifs, you might want to consider the Select Case
constru
ction.

Select Case

This is a very powerful construction, which is also easy to understand when written out. It is best for Integers and
lues are always obtained. Here is a simple example:
Strings, where exact va
Select Case K
Case 7 : Y = 6 : Z =
Case 7 : Y = Sqr (Sin (A) ) : Z = Sqr (Cos (A) )
Case N : Z = Y + X
Case Else :
End Select
Case N assume
s that the value of N has already been set. Case Else is included to cover other cases, whether
foreseen or not. It should always be included.
You can also provide lists of values.
Select Case K
Case 1, 2, 3, 5, 8, 13 : Y = 55 : Z = 89
Case 4, 9, 16, 25, 36 : Y = Sqr (Sin (A) ) : Z = Sqr (Cos (A) )
196
ERIES
. . . . Else
Booleans will be evaluated, whether you want that or not:
ting4
3
WRXi-OM-E Rev C

Advertisement

Table of Contents
loading

Table of Contents