• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

VBScript syntax for testing multiple values for a single variable without using multiple "OR" operators

What is the syntax for the determining whether a variable matches a value in a set.  

For example, if I want to determine whether or not a variable is equal to one of many values
if (SECTIONABV = "ACC") or (SECTIONABV = "AIM") or (SECTIONABV = "YYY") or .... then
    do something
end if

I would prefer to compare against a set of values, something like this

if SECTIONABV in ("ACC","AIM","YYY") then
    do something
end if

1 Solution
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
   Case "ACC", "AIM", "YYY"
      'Do that stuff
   Case Else
      'Do other stuff
End Select
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Tackle projects and never again get stuck behind a technical roadblock.
Join Now