I need to create a function. First variable must be an array with an unknown number of parameters plus another variable. My problem is that I don't know how distinguish between them.
I 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 loop array elements and concatenate them. I thought to get just
aa bb cc Where is my mistake?