WR6K-OM-E Rev A
ISSUED: October 2003
275
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
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)
)
Case 7, 15, 31, 63, 127 : Z = Y + X
Case Else : Z = 3
End Select
Case N assumes 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.
Summary of Contents for 6000 SERIES
Page 65: ...WR6K OM E Rev A ISSUED October 2003 63 Proper Orientation of Drive ...
Page 131: ...WR6K OM E Rev A ISSUED October 2003 129 Example ...
Page 141: ...WR6K OM E Rev A ISSUED October 2003 139 ...
Page 236: ...Operator s Manual 234 ISSUED October 2003 WR6K OM E Rev A Example 6 ...
Page 261: ...WR6K OM E Rev A ISSUED October 2003 259 ...
Page 286: ...Operator s Manual 284 ISSUED October 2003 WR6K OM E Rev A ...
Page 304: ...Operator s Manual 302 ISSUED October 2003 WR6K OM E Rev A ...
Page 307: ...WR6K OM E Rev A ISSUED October 2003 305 Convolve two signals ...
Page 348: ...Operator s Manual 346 ISSUED October 2003 WR6K OM E Rev A ...
Page 402: ...Operator s Manual 400 ISSUED October 2003 WR6K OM E Rev A ...