-
-
Save bielawb/7b34c8a0ee3a618c3181d8b9bf188982 to your computer and use it in GitHub Desktop.
Switch - używamy bloków skryptu
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
switch ($prostaZmienna) { | |
{ $_ -gt 10 } { | |
'Większa niż 10' | |
} | |
{ $_ -lt 0 } { | |
'♪ Mniej niż zero-o, mniej niz zero-o. O-o-o! ♪' | |
} | |
5 { | |
'Piąteczka!' | |
} | |
} | |
<# | |
Wynik dla różnych wartości zmiennej $prostaZmienna: | |
$prostaZmienna = 11 | |
Większa niż 10 | |
$prostaZmienna = 5 | |
Piąteczka! | |
$prostaZmienna = -5 | |
♪ Mniej niż zero-o, mniej niz zero-o. O-o-o! ♪ | |
#> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment