Skip to content

Conversation

@sdwheeler
Copy link
Collaborator

@sdwheeler sdwheeler commented Feb 26, 2024

PR Summary

Document range limits

PR Checklist

  • Descriptive Title: This PR's title is a synopsis of the changes it proposes.
  • Summary: This PR's summary describes the scope and intent of the change.
  • Contributor's Guide: I have read the contributors guide.
  • Style: This PR adheres to the style guide.

@learn-build-service-prod
Copy link
Contributor

Learn Build status updates of commit 5262c6d:

✅ Validation status: passed

File Status Preview URL Details
reference/5.1/Microsoft.PowerShell.Core/About/about_Operators.md ✅Succeeded View (powershell-5.1)
reference/7.2/Microsoft.PowerShell.Core/About/about_Operators.md ✅Succeeded View (powershell-7.2)
reference/7.3/Microsoft.PowerShell.Core/About/about_Operators.md ✅Succeeded View (powershell-7.3)
reference/7.4/Microsoft.PowerShell.Core/About/about_Operators.md ✅Succeeded View (powershell-7.4)
reference/7.5/Microsoft.PowerShell.Core/About/about_Operators.md ✅Succeeded View (powershell-7.5)

For more details, please refer to the build report.

For any questions, please:

@michaeltlombardi michaeltlombardi merged commit ea7c6e1 into MicrosoftDocs:main Feb 26, 2024
enumeration for your start and end values.
evaluate to an integer or a character. The endpoints of the range must be
convertible to signed 32-bit integers (`[int32]`). Larger values cause an
error. Also, if the range is captured in an array, the count of resulting is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick turnaround, but the word "numbers" is presumably missing after "count of resulting", and "the" is missing before "maximum size".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh!

evaluate to an integer or a character. The endpoints of the range must be
convertible to signed 32-bit integers (`[int32]`). Larger values cause an
error. Also, if the range is captured in an array, the count of resulting is
limited to maximum size of an array in .NET, which is `[int]::MaxValue - 56`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to mention that this limit only applies to PowerShell (Core) / .NET (Core). In Windows PowerShell / .NET Framework, it is 256MB - 8 (268435448): E.g., (1..268435448).Count works (if you have the patience), whereas (1..268435449).Count fails.

@sdwheeler sdwheeler deleted the sdw-w216085-i10906 branch February 26, 2024 20:48
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.

Range operator (..): make it clear that integer endpoints refers to [int32], specifically

3 participants