Skip to content

Instantly share code, notes, and snippets.

@Sambardo
Created February 28, 2018 19:21
Show Gist options
  • Save Sambardo/b3241702fdea9b45481300628fa4dce9 to your computer and use it in GitHub Desktop.
Save Sambardo/b3241702fdea9b45481300628fa4dce9 to your computer and use it in GitHub Desktop.
simple expression match for blog
$num = 4
Switch($num)
{
{$num -lt 5} {write-host "less than 5!" -ForegroundColor Magenta;break}
{$num -lt 10} {write-host "less than 10!" -ForegroundColor green;break}
{$num -lt 15} {write-host "less than 15!" -ForegroundColor cyan;break}
default {write-host "greater than or equal to 15" -ForegroundColor yellow}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment