I'm doing a comparison of two integer values, but don't know the type of comparison that will be used until a certain value is passed in. After determining the type of comparison ( >, <, >=, etc.) I want to assign that to a variable and pass it to a code block that performs the check. Here's a bit of code to explain:
Select Case equality
Case "gt"
comparer = ">"
Case "lt"
comparer = "<"
Case "eq"
comparer = "="
Case "ge"
comparer = ">="
Case "le"
comparer = "<="
End Select
Then I want to be able to use the comparer variable in a test, like:
If variable1 comparer variable2 Then
End If
Of course, this doesn't work, since comparer is not an operator. Is there a way to cast it into an operator, or to get it to evaluate to an operator, or is it necessary to create different tests with nearly identical code for each comparison type?
Select Case equality
Case "gt"
comparer = ">"
Case "lt"
comparer = "<"
Case "eq"
comparer = "="
Case "ge"
comparer = ">="
Case "le"
comparer = "<="
End Select
Then I want to be able to use the comparer variable in a test, like:
If variable1 comparer variable2 Then
End If
Of course, this doesn't work, since comparer is not an operator. Is there a way to cast it into an operator, or to get it to evaluate to an operator, or is it necessary to create different tests with nearly identical code for each comparison type?