Powershell Switch statement with multiple values

powershell

Anyone know how I can have a switch statement with multiple possible values like the example below?

switch ($myNumber) {
   1 3 5 7 9 { write-host "Odd" }
   2 4 6 8 10 {write-host "Even" }
}

Used to be easy in VBScript, so I'm sure i'm just missing something simple.

e.g in VBScript

Select Case myNumber 
   Case 1,3,5,7,9
      MsgBox "Odd"
   Case 2,4,6,8,10
      MsgBox "Even"
End Select

Cheers in advance,

Ben

Best Answer

$myNumber = 3
$arrA = 1, 3, 5, 7, 9
$arrB = 2, 4, 6, 8, 10
switch ($myNumber) { 
    {$arrA -contains $_} { write-host "Odd" } 
    {$arrB -contains $_} { write-host "Even" }
}