Skip to content

[powershell/en] remove comparison operators with bool #5306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

awelotta
Copy link

@awelotta awelotta commented May 8, 2025

  • [✅] I solemnly swear that this is all original content of which I am the original author
  • [✅] Pull request title is prepended with [language/lang-code] (example [python/fr] for Python in French or [java] for multiple Java translations)
  • [✅] Pull request touches only one file (or a set of logically related files with similar changes made)
  • [✅] Content changes are aimed at intermediate to experienced programmers (this is a poor format for explaining fundamental programming concepts)
  • [✅] If you've changed any part of the YAML Frontmatter, make sure it is formatted according to CONTRIBUTING.md

@awelotta
Copy link
Author

awelotta commented May 8, 2025

Rationale: the current explanation is not accurate. Rather, the right-hand side converts to the type of the left-hand side, so if the boolean is on the right and a numeric is on the right, we get different results.

$False -eq  0 # => True
$True  -eq  1 # => True
$True  -eq  2 # => True
$False -ne -5 # => True

I removed it because it seemed like a minor edge-case, but someone who actually has experience programming in PowerShell might have a better idea (would this come up a lot in PS scripts?).

learn.microsoft on about_Comparison_Operators

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant