February 2019
Intermediate to advanced
626 pages
15h 51m
English
Numeric assignments using the multiply and assign operator may be performed using *=. The value held by the variable i will be 4:
$i = 2 $i *= 2
The multiply and assign operator may be used to duplicate a string held in a variable:
$string = 'one' $string *= 2
The value on the right-hand side of the *= operator must be numeric or must be able to convert to a number. For example, a string containing the number 2 is acceptable:
$string = 'one' $string *= '2'
Using a string that is unable to convert to a number results in an error, as follows:
PS> $variable = 'one'PS> $variable *= 'one'Cannot convert value "one" to type "System.Int32". Error: "Input string was not in a correct ...
Read now
Unlock full access