Arguments in powershell don't get evaluated as I expect them. A mathematical expression as argument is casted to a string if the parameter type is object or string.
- Powershell code: write-host 1+1
- Result printed on screen: 1+1
- Expected result: 2
Could somebody tell me why does this happen? What is the logic behind this behavior?
In the language specification it clearly states that if the parameter is of type object then the value will be passed as is with no casting.
Could you please point me to the language specification that describes this behavior as I could not find it.
Note: any function that accepts an object or a string will suffer from the same behavior.