Arrays

suggest change

Array declaration in Powershell is almost the same as instantiating any other variable, i.e. you use a $name = syntax. The items in the array are declared by separating them by commas(,):

$myArrayOfInts = 1,2,3,4
$myArrayOfStrings = "1","2","3","4"

Adding to an arry

Adding to an array is as simple as using the \+ operator:

$myArrayOfInts = $myArrayOfInts + 5
//now contains 1,2,3,4 & 5!

Combining arrays together

Again this is as simple as using the \+ operator

$myArrayOfInts = 1,2,3,4
$myOtherArrayOfInts = 5,6,7
$myArrayOfInts = $myArrayOfInts + $myOtherArrayOfInts
//now 1,2,3,4,5,6,7

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents