I want to create an array containing arrays of two numbers. Pretty straightforward. However, If I do not provide a leading comma before the first array, it is incorrect. Why is this leading comma required?
PS C:srcpowershell> Get-Content .fr-btest.ps1
$files1 = @(
@(4, 1024)
, @((7), (16))
)
$files1
$files1.GetType()
$files1.Length
$files1.Count
'========'
$files2 = @(
, @(4, 1024)
, @((7), (16))
)
$files2
$files2.GetType()
$files2.Length
$files2.Count
PS C:srcpowershell> .fr-btest.ps1
4
1024
7
16
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Object[] System.Array
3
3
========
4
1024
7
16
True True Object[] System.Array
2
2
See Question&Answers more detail:os