I tried to describe a small 'list' of things, using arrays of arrays. An odd behaviour I observed:
function write-it-out([array] $arrays)
{
foreach($a in $arrays)
{
write-host "items" $a[0] $a[1]
}
}
$arrayOfArrays1 = @(
@("apple","orange"),
@("monkey","bear")
)
$arrayOfArrays2 = @(
@("android","linux")
)
# it works
write-it-out $arrayOfArrays1
# it wont
write-it-out $arrayOfArrays2
The first case outputs the expected two lines with the following content:
items apple orange
items monkey bear
But the second function call outputs not the expecteds
items android linux
but
items a n
items l i
Does somebody know why? And how to describe an array containing only one array inside, not more than one? So how to fix it? Thank guys in advance!