How to write 2 statements that differ just by Operator type in VB.NET

Posted by Richard Bysouth on Stack Overflow See other posts from Stack Overflow or by Richard Bysouth
Published on 2010-04-19T11:04:37Z Indexed on 2010/04/19 11:13 UTC
Read the original article Hit count: 160

Filed under:
|
|

Hi

I have the following code sample, where the only difference between the 2 parts of the If statement is the less than/greater than operators.

Is there a better way to write this? Could almost do with being able to define an Operator variable.

        If myVar = true Then

            Do While (X < Y)
                'call Method A
            Loop

        Else

            Do While (X > Y)
                'call Method A
            Loop

        End If

thanks

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about operators