Syntax:
Select Case Expression
Case expressionlist1
statement1
statement2 .... .... statement1n
Case expressionlist2
statement1
statement2 .... ....
Case expressionlistn
statement1
statement2 .... ....
Case Else
elsestatement1
elsestatement2 .... ....
End Select
Note: I had a value that i wanted to compare with list of values, when i tried to use if statement using OR or AND statement, it did not work because if statement is not comparing each value but compare only one value and turns other conditions to true. here is the ex:
if ((currentphase <> "test") OR (currentphase <>"development") OR (currentphase <> "Release and deployment") OR (currentphase <> "Warranty") then
--- here if the current phase is test, then rest all conditions will be true, that way everytime if is executing as True.
Alternate is Switch. This is useful to compare the value with list of values, if none of them matches go with else statement.
Select Case Expression
Case expressionlist1
statement1
statement2 .... .... statement1n
Case expressionlist2
statement1
statement2 .... ....
Case expressionlistn
statement1
statement2 .... ....
Case Else
elsestatement1
elsestatement2 .... ....
End Select
Note: I had a value that i wanted to compare with list of values, when i tried to use if statement using OR or AND statement, it did not work because if statement is not comparing each value but compare only one value and turns other conditions to true. here is the ex:
if ((currentphase <> "test") OR (currentphase <>"development") OR (currentphase <> "Release and deployment") OR (currentphase <> "Warranty") then
--- here if the current phase is test, then rest all conditions will be true, that way everytime if is executing as True.
Alternate is Switch. This is useful to compare the value with list of values, if none of them matches go with else statement.
No comments:
Post a Comment