Skip to content

Commit 9a557de

Browse files
authored
Merge pull request #1226 from PrzemyslawKlys/patch-1
Update PossibleIncorrectComparisonWithNull.md
2 parents b5648de + 6447bf8 commit 9a557de

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

RuleDocumentation/PossibleIncorrectComparisonWithNull.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
To ensure that PowerShell performs comparisons correctly, the `$null` element should be on the left side of the operator.
88

99
There are a number of reasons why this should occur:
10-
* `$null` is a scalar. When the input (left side) to an operator is a scalar value, comparison operators return a Boolean value. When the input is a collection of values, the comparison operators return any matching values, or an empty array if there are no matches in the collection. The only way to reliably check if a value is `$null` is to place `$null` on the left side of the operator so that a scalar comparison is perfomed.
10+
* `$null` is a scalar. When the input (left side) to an operator is a scalar value, comparison operators return a Boolean value. When the input is a collection of values, the comparison operators return any matching values, or an empty array if there are no matches in the collection. The only way to reliably check if a value is `$null` is to place `$null` on the left side of the operator so that a scalar comparison is performed.
1111
* PowerShell will perform type casting left to right, resulting in incorrect comparisons when `$null` is cast to other scalar types.
1212

1313
## How

0 commit comments

Comments
 (0)