Skip to content

Commit adb5089

Browse files
authored
Update PossibleIncorrectComparisonWithNull documentation with better example
1 parent 64b77fb commit adb5089

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

RuleDocumentation/PossibleIncorrectComparisonWithNull.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ function Test-CompareWithNull
4141
## Try it Yourself
4242

4343
``` PowerShell
44-
if (@() -eq $null) { 'true' } else { 'false' } # Returns false
45-
if ($null -ne @()) { 'true' } else { 'false' } # Returns true
44+
# Both expressions below return 'false' because the comparison does not return an object and therefore the if statement always falls through:
45+
if (@() -eq $null) { 'true' }else { 'false' }
46+
if (@() -ne $null) { 'true' }else { 'false' }
4647
```

0 commit comments

Comments
 (0)