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 answers

0
Mike Shepard On BEST ANSWER

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