Switch-Case with multiple Values


I’m writing a code at the moment where I want to install network-shared printers automatically. Which printer the script should install depends on whether a user works for example in Sales or HR. I wanted to solve this problem with a switch statement, but the problem is that it always matches the first value.

I tried several combinations of continue- or break-points, but none of them lead to my desired result.


Normally, the console output should be “2”, but it is “1” “2”.


Change the condition block to:

This way both terms will match the switch case


Switch-Case with multiple Values by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply