W
AVE
R
UNNER
X
I
S
ERIES
196
WRXi-OM-E Rev C
. . . . Else
AnyVBScriptingOnOneLine
Booleans will be evaluated, whether you want that or not:
hen VBScripting1
VBScripting2
> 6 Then VBScripting3
ting4
en VBScripting6
y careful when testing for equality. There will be no trouble with Integers, Long Integers, and Strings, but
rs are different. Because they have so many significant digits, values that should be equal, may differ
utation. It is safer with Real numbers to test using a tolerance band.
xample: IfThenElse.xls
t you are building up a rather complicated set of Ifs, you might want to consider the Select Case
ction.
lues are always obtained. Here is a simple example:
3
s that the value of N has already been set. Case Else is included to cover other cases, whether
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) )
End If
Summary of If . . . . Then
If Boolean Then
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
If A > 7 Then
If A
If A > 4 Then VBScrip
If A > 3 Then VBScripting5
If A > 1 Th
Be ver
Real numbe
minutely after a comp
File for this e
If you find tha
constru
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 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
foreseen or not. It should always be included.
You can also provide lists of values.