Why does order of operands matter when adding powershell strings and arrays?

83 Views Asked by At

In powershell, when I add string + array the result is a string, but when I add array + string the result is an array? Why is that?

string plus array vs array plus string

1

There are 1 best solutions below

0
Mike Shepard On BEST ANSWER

PowerShell converts the second operand to the type of the first operand (if it can).