February 2019
Intermediate to advanced
626 pages
15h 51m
English
Given that an array contains objects, an array can therefore also contain other arrays.
For example, an array that contains other arrays (a multi-dimensional array) might be created as follows:
$arrayOfArrays = @(
@(1, 2, 3),
@(4, 5, 6),
@(7, 8, 9)
)
Be careful to ensure that the comma following each of the inner arrays (except the last) is in place. If that comma is missing, the entire structure will be flattened, merging the three inner arrays.
Elements in the array are accessed by indexing into each array in turn (starting with the outermost). The element with the value 2 is accessible using the following notation:
PS> $arrayOfArrays[0][1]2
This states that we wish to retrieve the first element (which ...
Read now
Unlock full access