Examples: $a = [int[]](10,20) # [int[]], Length 2 $a + "red" # [object[]], Length 3 $a + 12.5,$true # [object[]], Length 4 $a + (New-Object 'float[,]' 2,3) # [object[]], Length 8 (New-Object 'float[,]' 2,3) + $a # [object[]], Length 8 Hashtable concatenation Description: When both operands designate Hashtables the binary + operator creates a new Hashtable that contains the elements designated by the left operand followed immediately by the elements designated by the right operand. If the Hashtables contain the same key, an implementation-defined terminating error is raised.. This operator is left associative. Examples: $h1 = @{ FirstName = "James"; LastName = "Anderson" } $h2 = @{ Dept = "Personnel" } $h3 = $h1 + $h2 # new Hashtable, Count = 3 Windows PowerShell: If the Hashtables contain the same key, an exception of type BadOperatorArgument is raised. Subtraction Description: The result of the subtraction operator - is the difference when the value designated by the right operand is subtracted from the value designated by the left operand after the usual arithmetic conversions (§6.15) have been applied. This operator is left associative. Examples: 12 - -10L # long result 2c -10.300D - 12 # decimal result -22.300 10.6 - 12 # double result -1.4 12 - "0xabc" # int result -2736
Examples: $a = [int[]](10,20) # [int[]], Length 2 $a + "red" # [object[]], Length 3 $a + 12.5,$true # [object[]], Length 4 $a + (New-Object 'float[,]' 2,3) # [object[]], Length 8 (New-Object 'float[,]' 2,3) + $a # [object[]], Length 8 Hashtable concatenation Description: When both operands designate Hashtables the binary + operator creates a new Hashtable that contains the elements designated by the left operand followed immediately by the elements designated by the right operand. If the Hashtables contain the same key, an implementation-defined terminating error is raised.. This operator is left associative. Examples: $h1 = @{ FirstName = "James"; LastName = "Anderson" } $h2 = @{ Dept = "Personnel" } $h3 = $h1 + $h2 # new Hashtable, Count = 3 Windows PowerShell: If the Hashtables contain the same key, an exception of type BadOperatorArgument is raised. Subtraction Description: The result of the subtraction operator - is the difference when the value designated by the right operand is subtracted from the value designated by the left operand after the usual arithmetic conversions (§6.15) have been applied. This operator is left associative. Examples: 12 - -10L # long result 2c -10.300D - 12 # decimal result -22.300 10.6 - 12 # double result -1.4 12 - "0xabc" # int result -2736
PowerShell%202%200%20Language%20Specification.docx