February 2019
Intermediate to advanced
626 pages
15h 51m
English
The addition operator may be used to add numeric values. For example, the simple addition operation below will result in the value 5.14159:
2.71828 + 3.14159
The addition operator 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' ...
Read now
Unlock full access