Skip to content

add RangeToExclusivePattern to the reference #1746

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

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,9 @@ r[patterns.range.syntax]
> _RangeFromPattern_ :\
>       _RangePatternBound_ `..`
>
> _RangeToExclusivePattern_ :\
>  &nsbp;    `..` _RangePatternBound_
>
> _RangeToInclusivePattern_ :\
>       `..=` _RangePatternBound_
>
Expand Down Expand Up @@ -537,8 +540,9 @@ For example, `1..` will match 1, 9, or 9001, or 9007199254740991 (if it is of an

r[patterns.range.open-above]
A range pattern with only an upper bound matches any value less than or equal to the upper bound.
It is written as `..=` followed by its upper bound, and has the same type as its upper bound.
For example, `..=10` will match 10, 1, 0, and for signed integer types, all negative values.
It is written as `..=` for an end-inclusive or `..` for an end-exclusive pattern, followed by its upper bound,
and has the same type as its upper bound.
For example, `..=10` will match 10, 1, 0, and for signed integer types, all negative values, while `..10` will not match 10.

r[patterns.range.constraint-slice]
Range patterns with only one bound cannot be used as the top-level pattern for subpatterns in [slice patterns](#slice-patterns).
Expand Down