October 2017
Intermediate to advanced
440 pages
11h 47m
English
The addition operator may be used to add numeric values:
2.71828 + 3.14159
It may also be used to concatenate strings:
'hello' + ' ' + 'world'
If an attempt is made to concatenate a string with a number, the number will be converted into a string:
'hello number ' + 1
This style of operation will fail if the number is used first. PowerShell expects the entire expression to be numeric if that is how it begins:
PS> 1 + ' is the number I like to use'Cannot convert value "is the number I like to use" to type "System.Int32". Error: "Input string was not in a correct format."At line:1 char:1+ 1 + ' is the number I like to use'+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [], RuntimeException ...
Read now
Unlock full access