I need to create a function. The first variable should be an array with an unknown number of parameters plus another variable. My problem is that I do not know how to distinguish between them.
Post an example:
function conc-str { param([string[]]$array,[string]$name) foreach($item in $array) { $str+= $item } write-host $str } conc-str(@("aa","bb","cc"),"dd")
The result of this function is
aa bb ccdd
but, as you can see, I process the elements of the array and combine them. I thought that just
aa bb cc
Where is my mistake?
source share