Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
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
9 changes: 6 additions & 3 deletions src/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ match tuple {
> **<sup>Syntax</sup>**\
> _RangePattern_ :\
> &nbsp;&nbsp; _RangePatternBound_ `..=` _RangePatternBound_
> _RangeFromPattern_ :\
> &nbsp;&nbsp; _RangePatternBound_ `..`
>
> _ObsoleteRangePattern_ :\
> &nbsp;&nbsp; _RangePatternBound_ `...` _RangePatternBound_
Expand All @@ -414,9 +416,10 @@ match tuple {
> &nbsp;&nbsp; | [_PathInExpression_]\
> &nbsp;&nbsp; | [_QualifiedPathInExpression_]

Range patterns match values that are within the closed range defined by its lower and
upper bounds. For example, a pattern `'m'..='p'` will match only the values `'m'`, `'n'`,
`'o'`, and `'p'`. The bounds can be literals or paths that point to constant values.
Range patterns match values that are within a range defined by its lower and upper bounds (if any).
For example, a pattern `'m'..='p'` will match only the values `'m'`, `'n'`, `'o'`, and `'p'`. A
pattern `1..` will match values equal to or greater than 1, but not 0 (or negative numbers, for
signed integers). The bounds can be literals or paths that point to constant values.

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