-
-
Save bielawb/abb39e14251091e343b9901d37173ce5 to your computer and use it in GitHub Desktop.
Switch - break bez kolekcji
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
$procentWolnejPamięci = 30 | |
switch ($procentWolnejPamięci) { | |
{ $_ -gt 70 } { | |
'OK' | |
break | |
} | |
{ $_ -gt 50 } { | |
'Tak sobie...' | |
break | |
} | |
{ $_ -gt 20 } { | |
'Kiepsko' | |
break | |
} | |
{ $_ -gt 10 } { | |
'Oops?' | |
break | |
} | |
default { | |
'Pożar!' | |
} | |
} | |
# Na wyjściu tylko "Kiepsko", mimo że blok skryptu przy 'Oops' też zwróciłby wartość logiczną $true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment