You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -422,10 +425,11 @@ A bound on the left of the sigil is a *lower bound*.
422
425
A bound on the right is an *upper bound*.
423
426
424
427
A range pattern with both a lower and upper bound will match all values between and including both of its bounds.
425
-
It is written as its lower bound, followed by `..=`, followed by its upper bound.
428
+
It is written as its lower bound, followed by `..` for end-exclusive or `..=` for end-inclusive, followed by its upper bound.
426
429
The type of the range pattern is the type unification of its upper and lower bounds.
427
430
428
431
For example, a pattern `'m'..='p'` will match only the values `'m'`, `'n'`, `'o'`, and `'p'`.
432
+
Similarly, `'m'..'p'` will match only `'m'`, `'n'` and `'o'`, specifically **not** including `'p'`.
429
433
430
434
The lower bound cannot be greater than the upper bound.
431
435
That is, in `a..=b`, a ≤ b must be the case.
@@ -467,7 +471,7 @@ let valid_variable = match c {
467
471
468
472
# letph=10;
469
473
println!("{}", matchph {
470
-
0..=6=>"acid",
474
+
0..7=>"acid",
471
475
7=>"neutral",
472
476
8..=14=>"base",
473
477
_=>unreachable!(),
@@ -539,9 +543,6 @@ See [issue #41620](https://github.com/rust-lang/rust/issues/41620) for more info
539
543
540
544
> **Edition Differences**: Before the 2021 edition, range patterns with both a lower and upper bound may also be written using `...` in place of `..=`, with the same meaning.
541
545
542
-
> **Note**: Although range patterns use the same syntax as [range expressions], there are no exclusive range patterns.
543
-
> That is, neither `x .. y` nor `.. x` are valid range patterns.
0 commit comments