We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f91216b + 4db0efb commit 53d6b38Copy full SHA for 53d6b38
src/doc/reference.md
@@ -2806,6 +2806,33 @@ _panicked state_.
2806
(["a", "b"])[10]; // panics
2807
```
2808
2809
+### Range expressions
2810
+
2811
+```{.ebnf .gram}
2812
+range_expr : expr ".." expr |
2813
+ expr ".." |
2814
+ ".." expr |
2815
+ ".." ;
2816
+```
2817
2818
+The `..` operator will construct an object of one of the `std::ops::Range` variants.
2819
2820
2821
+1..2; // std::ops::Range
2822
+3..; // std::ops::RangeFrom
2823
+..4; // std::ops::RangeTo
2824
+..; // std::ops::RangeFull
2825
2826
2827
+The following expressions are equivalent.
2828
2829
2830
+let x = std::ops::Range {start: 0, end: 10};
2831
+let y = 0..10;
2832
2833
+assert_eq!(x,y);
2834
2835
2836
### Unary operator expressions
2837
2838
Rust defines three unary operators. They are all written as prefix operators,
0 commit comments