Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1767
  • Last Modified:

Multiple values in case evaluation of a switch statement

Am I able to evaluate multiple values in the case section of a switch statement
switch (country) {
        case '':
 
            break;
 
        case 'AL','DC':
 
            break;
 
        default :
 
            break;
    }

Open in new window

0
ruffone
Asked:
ruffone
1 Solution
 
ruffoneAuthor Commented:
this solved my issue

switch (country) {
        case '':
 
            break;
 
        case 'AL':
        case 'DC':
 
            break;
 
        default :
 
            break;
    }

Open in new window

0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

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