Using logical And operator in the Select Case statement
Select Case dblA
....Case Is > 1.22 And Is < 3.4
....Case Is > 4.1
....Case Else
End Select
Select Case sProductName
....Case Is > sPrevProdName And Is Like "* tea *"
....Case "apple juice"
End Select
3 comments
-
Robert Einhorn
commented
The AndAlso logical operator also would be suggested Of course.
In addition, I would like to suggest two logical operators more:
Xor
NotAn example with the Xor operator:
Select Case myNumber
....Case Is > a Xor Is > bEnd Select
An example with the Not operator:
Select Case sProductName
....Case Is > sPrevProdName And Is Not Like "* tea *"End Select
-
Robert Einhorn
commented
I would like to note that instead of the following code...:
Select Case dblA
....Case Is > 1.22 And Is < 3.4End Select
, I would suggest rather this:
Select Case dblA
....Case 1.22 >< 3.4End Select
related topics:
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2406727-using-between-operator-in-the-select-case-statemen -
Robert Einhorn
commented