Why is this happening. I have two arrays. The first is changed in a function, the second serves as a copy of the first array. But it doesn't work. My code:
function testArray
{
param
(
[parameter(Mandatory=$true)][array]$Board
)
$Board[1] = 'X'
return $Board
}
[array]$test = @('.','.','.','.')
[array]$testCopy = $test
$test = testArray -Board $test
Write-Host $test
Write-Host $testCopy
Output:
. X . .
. X . .
Powershell Version: 5.1
Thanks
I have no idee why it happening.