switch

$num = 22
switch ($num)
{
1
{Write-Host "this is 1";break}
2
{Write-Host "this is 2"
1+2
break
}
default
{Write-Host "cpp";break}
}

原文地址:https://www.cnblogs.com/dreamer-fish/p/3724209.html