Created
January 22, 2011 22:43
-
-
Save stej/791578 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function switchtest { | |
param([switch]$myswitch) | |
if ($myswitch) { 'switch is on' } | |
if (!$myswitch) { 'switch if off' } | |
#same as above | |
#if ($myswitch) { 'switch is on' } else { 'switch if off' } | |
write-host switch value is ([bool]$myswitch) and $myswitch | |
} | |
## test | |
PS> switchtest -myswitch | |
switch is on | |
switch value is True and True | |
PS> switchtest | |
switch if off | |
switch value is False and False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Přijímám patche ;)