---
Private Sub CodeRed(ByVal iInput As Integer)
Dim launchCodes() As Integer = New Integer() {2, 22, 66, 97, 105,
190}
Array.Sort(launchCodes)
Dim found As Integer = Array.BinarySearch(launchCodes, iInput)
If (found > -1) Then
'The launchCode matched. Launch the nukes. Yippeee!
LaunchTheNukes()
Else
'The launchCode is fake. Maybe next time... HeHeHe
End If
End Sub
---
On Oct 15, 3:53 am, Phil <[email protected]> wrote:
> Hopefully a simply question on vb.net syntax.
> I have a variable, lets call it iInput, which is an integer.
> If iInput is one of several values, for example 2,22,66,97,105 or 190
> then I have to do something.
>
> Is there a simple way to do this check?
>
> I seem to remember from VB that there's somethng like
> If iInput in [2,22,66,97,105,190] or maybe using () instead.
>
> I'm trying to find a more elegant way to do this than
>
> If iInput = 2 or iInput = 22 or iInput = 66 .... then
>
> Is there a neat way to do this?
>
> Thanks
>
> Phil.