How to set the default argument to an array
The reason this happens is that you have specified that your Parameter $games
is a string, what you want is an array of strings: string[]
so your code becomes:
param (
[string[]]$games = @('Subnautica', 'Gearcity')
)
This bit: [string]$games
forces your variable to be a string. To make it an array of strings you need to add[]
to variable type declaration.
[string[]]$games = @('Subnautica', 'Gearcity')