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