Created
February 28, 2018 19:24
-
-
Save Sambardo/c11291b009f98d634dba0490bf2197c8 to your computer and use it in GitHub Desktop.
careful with break!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$nums = 1..15 | |
Switch($nums) | |
{ | |
{$_ -lt 5} {write-host "$_ is less than 5!" -ForegroundColor Magenta;break} | |
{$_ -lt 10} {write-host "$_ is less than 10!" -ForegroundColor green;break} | |
{$_ -lt 15} {write-host "$_ is less than 15!" -ForegroundColor cyan;break} | |
default {write-host "$_ is 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