Skip to content

Commit d845bc3

Browse files
Add RangeFrom patterns
1 parent 0eb434d commit d845bc3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/patterns.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,8 @@ match tuple {
402402
> **<sup>Syntax</sup>**\
403403
> _RangePattern_ :\
404404
> &nbsp;&nbsp; _RangePatternBound_ `..=` _RangePatternBound_
405+
> _RangeFromPattern_ :\
406+
> &nbsp;&nbsp; _RangePatternBound_ `..`
405407
>
406408
> _ObsoleteRangePattern_ :\
407409
> &nbsp;&nbsp; _RangePatternBound_ `...` _RangePatternBound_
@@ -414,9 +416,10 @@ match tuple {
414416
> &nbsp;&nbsp; | [_PathInExpression_]\
415417
> &nbsp;&nbsp; | [_QualifiedPathInExpression_]
416418
417-
Range patterns match values that are within the closed range defined by its lower and
418-
upper bounds. For example, a pattern `'m'..='p'` will match only the values `'m'`, `'n'`,
419-
`'o'`, and `'p'`. The bounds can be literals or paths that point to constant values.
419+
Range patterns match values that are within a range defined by its lower and upper bounds (if any).
420+
For example, a pattern `'m'..='p'` will match only the values `'m'`, `'n'`, `'o'`, and `'p'`. A
421+
pattern `1..` will match values equal to or greater than 1, but not 0 (or negative numbers, for
422+
signed integers). The bounds can be literals or paths that point to constant values.
420423

421424
A pattern a `..=` b must always have a &le; b. It is an error to have a range pattern
422425
`10..=0`, for example.

0 commit comments

Comments
 (0)