Skip to content

Instantly share code, notes, and snippets.

@bielawb
Created June 23, 2020 23:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bielawb/96e5da692694646187ae99d6535812a3 to your computer and use it in GitHub Desktop.
Save bielawb/96e5da692694646187ae99d6535812a3 to your computer and use it in GitHub Desktop.
Switch - operujemy na kolekcji
$użycieCpu = 50, 80, 90
switch ($użycieCpu) {
50 {
"Połówka"
}
{ $_ -gt 30 } {
"Ciepło... ($_)"
}
{ $_ -gt 70 } {
"Gorąco! ($_)"
}
}
<#
Na wyjściu:
Połówka
Ciepło... (50)
Ciepło... (80)
Gorąco! (80)
Ciepło... (90)
Gorąco! (90)
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment