I am new to powershell an tried a function which generates an array.
function array_create {
$array = [System.Collections.ArrayList]@()
$array.Add('hello')
$array.Add('world')
return $array
}
$arr = array_create
foreach($a in $arr){
$a
}
even if I put @() arround the function call the output is
0
1
hello
world
how would I correctly return an array with only values (no numbers) and why does this happen ?
[void]$array.Add('hello')or$null = $array.Add('hello')