Skip to content

Commit a84ea27

Browse files
m4rch3n1ngehuss
authored andcommitted
add RangeToExclusivePattern to the reference
1 parent 4d92113 commit a84ea27

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/patterns.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,9 @@ r[patterns.range.syntax]
492492
> _RangeFromPattern_ :\
493493
>       _RangePatternBound_ `..`
494494
>
495+
> _RangeToExclusivePattern_ :\
496+
>       `..` _RangePatternBound_
497+
>
495498
> _RangeToInclusivePattern_ :\
496499
>       `..=` _RangePatternBound_
497500
>
@@ -537,8 +540,9 @@ For example, `1..` will match 1, 9, or 9001, or 9007199254740991 (if it is of an
537540

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

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

0 commit comments

Comments
 (0)