-
-
Save bielawb/4b03e2fd0c50115bcfdde6bea27c8539 to your computer and use it in GitHub Desktop.
Rodzaje zmiennych
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
$zmienne = [ordered]@{ | |
Data = Get-Date | |
Int = 5 | |
Ciąg = 'mój ciąg znaków' | |
TablicaSkrótów = @{ a = 1; b = 2 } | |
Lista = [Collections.ArrayList]@(1, 2, 3) | |
} | |
foreach ($typ in $zmienne.Keys) { | |
$zmienna = $zmienne.$typ | |
if ($zmienna.GetType().IsValueType) { | |
"Zmienna prosta: $typ" | |
} else { | |
"Zmienna złożona: $typ" | |
} | |
} | |
<# | |
Na wyjściu: | |
Zmienna prosta: Data | |
Zmienna prosta: Int | |
Zmienna złożona: Ciąg | |
Zmienna złożona: TablicaSkrótów | |
Zmienna złożona: Lista | |
#> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment