I'm working on a script and while searching for something on the internet, I found these lines in PowerShell:
Function Add-Script ([string] $script, [bool] $reboot = $false) {
$script:scripts += ,@($script, $reboot)
}
I tried to search in the Microsoft documentation but I'm not finding any concept related to the $script:scripts part and I don't understand why there is a comma after the +=.
The $scripts object is created with a global scope and we can use it if by calling '$scripts'. It will contain an array of array and will become bigger if we call this function many times.
So is there anyone who understand the this last line of code and maybe send the documentation related to it ? It would be really nice.
Thanks !