What's the best way to initialize an array in PowerShell?
For example, the code
$array = @()
for($i=0; $i -lt 5;$i++)
{
$array[$i] = $FALSE
}
generates the error
Array assignment failed because index '0' was out of range.
At H:SoftwarePowerShellTestArray.ps1:4 char:10
+ $array[$ <<<< i] = $FALSE
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…