February 2019
Intermediate to advanced
626 pages
15h 51m
English
The multiplication operator is able to perform simple numeric operations. For example, the result of the following expression is 5:
2.5 * 2
The multiplication operator may also be used to duplicate strings, resulting in hellohellohello:
'hello' * 3
As with the addition operator, the multiplication operator will throw an error if a number is on the left of the expression:
PS> 3 * 'hello'Cannot convert value "hello" to type "System.Int32". Error: "Input string was not in a correct format."At line:1 char:2+ 3 * 'hello'+ ~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [], RuntimeException + FullyQualifiedErrorId : InvalidCastFromStringToInteger
The multiplication operator may also be used to duplicate arrays. Each ...
Read now
Unlock full access